Can I debug with python debugger when using py.test somehow?

前端 未结 6 692
悲&欢浪女
悲&欢浪女 2020-12-08 09:22

I am using py.test for unit testing my python program. I wish to debug my test code with the python debugger the normal way (by which I mean pdb.set_trace() in the code) but

6条回答
  •  北海茫月
    2020-12-08 09:39

    I found that I can run py.test with capture disabled, then use pdb.set_trace() as usual.

    > py.test --capture=no
    ============================= test session starts ==============================
    platform linux2 -- Python 2.5.2 -- pytest-1.3.3
    test path 1: project/lib/test/test_facet.py
    
    project/lib/test/test_facet.py ...> /home/jaraco/projects/project/lib/functions.py(158)do_something()
    -> code_about_to_run('')
    (Pdb)
    

提交回复
热议问题