How to show full Python Traceback with Tox/Py.test

Cer*_*rin 5 python pytest tox

I'm using tox and py.test to run my Python unittests, and even though I'm using py.test's --tb=long option, errors are showing like:

E   ConftestImportFailure: (local('/myproject/tests/functional_tests/conftest.py'), (<type 'exceptions.ImportError'>, ImportError('No module named blah',), <traceback object at 0x7fb5bb740518>))
Run Code Online (Sandbox Code Playgroud)

Tox is running the command:

py.test -rxs -rf -rs --ff --tb=long -x -k testname
Run Code Online (Sandbox Code Playgroud)

How do I make is show the full traceback? I can't find anything mentioning this in the docs besides the --tb option.

blu*_*e10 5

对于 pytest,您可以使用py.test --tb=native切换到完整/本机 Python 回溯。

请参阅有关回溯的pytest 文档


小智 0

通过将{posargs}or[]放入命令调用中,您可以运行tox -- --full-trace

ConftestImportFailure 往往也指向另一个错误,他们的报告更糟糕