pytest allows to hide the trackeback for assert helpers by defining
def assert_helper(asdf):
__tracebackhide__ = True
assert asdf
It also allows redefining the patterns, by which test items are collected.
Is there maybe some clever way, to modify the test item collection in a way, so that it automatically sets __tracebackhide__ = True
for all assert helpers, when they are following a certain naming scheme, e.g. all functions starting with assert_
? How could that be configured in conftest.py
?
Or is there maybe some general way to define patterns for functions, whose traceback is not relevant? I'm also using lots of assert helpers from numpy.testing
and it would be a charm to get rid of their tracebacks.
Aucun commentaire:
Enregistrer un commentaire