pytest 进入pdb模式
如题,怎么进入呢?
我按照
https://blog.csdn.net/waitan2018/article/details/104399850
所示
import pytest
class TestDemoA:
@pytest.mark.parametrize('data', [1, 2, 3, 4])
def test_A_001(self, data):
# 当 data>2 时会断言失败进入调试模式
if data > 2:
assert 0
if __name__ == '__main__':
pytest.main(['-q', '--pdb'])
他的结果是
我的结果是
D:\PF\program\anaconda\envs\test_skip\python.exe D:\PF\program\JetBrains\PyCharm2021\plugins\python\helpers\pycharm\_jb_pytest_runner.py --path F:/work/program/python/test_skip/test_27.py
Testing started at 20:31 ...
Launching pytest with arguments F:/work/program/python/test_skip/test_27.py --no-header --no-summary -q in F:\work\program\python\test_skip
============================= test session starts =============================
collecting ... collected 4 items
test_27.py::TestDemoA::test_A[1]
test_27.py::TestDemoA::test_A[2]
test_27.py::TestDemoA::test_A[3] PASSED [ 25%]PASSED [ 50%]FAILED [ 75%]
test_27.py:4 (TestDemoA.test_A[3])
self = <test_27.TestDemoA object at 0x000002575C46FF70>, data = 3
@pytest.mark.parametrize('data',[1,2,3,4])
def test_A(self,data):
if data >2:
> assert 0
E assert 0
test_27.py:8: AssertionError
FAILED [100%]
test_27.py:4 (TestDemoA.test_A[4])
self = <test_27.TestDemoA object at 0x000002575C46F3A0>, data = 4
@pytest.mark.parametrize('data',[1,2,3,4])
def test_A(self,data):
if data >2:
> assert 0
E assert 0
test_27.py:8: AssertionError
test_27.py::TestDemoA::test_A[4]
========================= 2 failed, 2 passed in 0.18s =========================
Process finished with exit code 1
没有进入pdb啊
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论