I am normally running tests locally against a DB in Docker; I ran tests via Docker once, and since then pytest stopped showing me traceback for the failed tests, only showing > ???
instead.
Running pytest as pytest --vv
showed that it tried to find a source code in the wrong path, using path as if it runs inside Docker (even though I was running it locally).
What seems to have happened is the following:
- running tests via Docker created Python cache (
__pycache__/*.pyc
) owned by root; - re-running tests locally picked up that cached bytecode (either couldn't or didn't try to delete/overwrite it), tried accessing source code with the path hardcoded in cache (that is, with paths as they are in Docker), and failed.
Once I deleted cached files, it started working again.