I have a project like:
/app
/app
foo.py
bar.py
/tests
__init__.py
core.py
test_foo.py
test_bar.py
In core.py, I have some functions that call assert. These functions are imported into test_foo.py and test_bar.py.
Calling pytest test_foo.py by default will not pretty print any of the values used in the assert, if the assert was called from a function imported from core.py.
One way around this is to add the following to tests/__init__.py:
import pytest
pytest.register_assert_rewrite('tests.core')
However, this is inconvenient as you would need to add every module from your tests directory into this call.
Is there a way to get pytest to do this automatically, without me having to specify each module I want pytest to rewrite?