我正在使用tox和py.test运行Python的单元测试,即使我使用了py.test的--tb=long
选项,错误信息也会出现类似于:
E ConftestImportFailure: (local('/myproject/tests/functional_tests/conftest.py'), (<type 'exceptions.ImportError'>, ImportError('No module named blah',), <traceback object at 0x7fb5bb740518>))
Tox正在运行以下命令:
py.test -rxs -rf -rs --ff --tb=long -x -k testname
如何显示完整的回溯信息?除了使用--tb
选项,我在文档中找不到其他相关内容。
py.test -vvs --pdb -k testname
命令,它会将您带到pdb
提示符来进行调试。(我知道这适用于测试,但不能保证百分之百适用于conftest)。 - sashk