Cleaner pytest tracebacks with collector plugin #9792
Unanswered
hauntsaninja
asked this question in
Q&A
Replies: 1 comment
-
Okay, I think I want something like:
and to make sure |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello all!
I'm writing my first pytest plugin. It collects tests from some data files, not too unlike the YAML example in the documentation, except that the data files can be dynamically generated on demand.
I have something like the following and it mostly works great:
However, tracebacks now have a lot of pytest gunk in them, including from frames that have
__tracebackhide__ = True
.Here's an example of the messy tracebacks:
=============================================================================== FAILURES ================================================================================
_____________________________________________________________________________ test session ______________________________________________________________________________
cls = <class '_pytest.runner.CallInfo'>, func = <function call_runtest_hook.. at 0x107071ee0>, when = 'call'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
../../../.virtualenvs/cbqc/lib/python3.9/site-packages/_pytest/runner.py:311:
../../../.virtualenvs/cbqc/lib/python3.9/site-packages/_pytest/runner.py:255:
self = <_HookCaller 'pytest_runtest_call'>, args = (), kwargs = {'item': <SnapshotItem (redacted data file name)>}, argname = 'item', firstresult = False
../../../.virtualenvs/cbqc/lib/python3.9/site-packages/pluggy/_hooks.py:265:
self = <_pytest.config.PytestPluginManager object at 0x10474c6a0>, hook_name = 'pytest_runtest_call'
methods = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/Users/shantanu/.virtualenvs/cbqc/lib/py...ion' from '/Users/shantanu/.virtualenvs/cbqc/lib/python3.9/site-packages/_pytest/unraisableexception.py'>>, ...]
kwargs = {'item': <SnapshotItem (redacted data file name)>}, firstresult = False
../../../.virtualenvs/cbqc/lib/python3.9/site-packages/pluggy/_manager.py:80:
hook_name = 'pytest_runtest_call'
hook_impls = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/Users/shantanu/.virtualenvs/cbqc/lib/py...ion' from '/Users/shantanu/.virtualenvs/cbqc/lib/python3.9/site-packages/_pytest/unraisableexception.py'>>, ...]
caller_kwargs = {'item': <SnapshotItem (redacted data file name)>}, firstresult = False
../../../.virtualenvs/cbqc/lib/python3.9/site-packages/pluggy/_callers.py:60:
self = <pluggy._result._Result object at 0x107046af0>
../../../.virtualenvs/cbqc/lib/python3.9/site-packages/pluggy/_result.py:60:
hook_name = 'pytest_runtest_call'
hook_impls = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/Users/shantanu/.virtualenvs/cbqc/lib/py...ion' from '/Users/shantanu/.virtualenvs/cbqc/lib/python3.9/site-packages/_pytest/unraisableexception.py'>>, ...]
caller_kwargs = {'item': <SnapshotItem (redacted data file name)>}, firstresult = False
../../../.virtualenvs/cbqc/lib/python3.9/site-packages/pluggy/_callers.py:39:
item = <SnapshotItem (redacted data file name)>
../../../.virtualenvs/cbqc/lib/python3.9/site-packages/_pytest/runner.py:170:
item = <SnapshotItem (redacted data file name)>
../../../.virtualenvs/cbqc/lib/python3.9/site-packages/_pytest/runner.py:162:
self = <SnapshotItem (redacted data file name)>
E AssertionError
Beta Was this translation helpful? Give feedback.
All reactions