conftest.py import shadowing my package name in pytest
pytest 8.1. My project has a top-level package called app/. I also have tests/conftest.py. When I run pytest, inside conftest I do import app.config and it imports something weird — turns out pytest adds tests/ to sys.path and there's a tests/app.py fixture helper that shadows my real package. How do I avoid this without renaming everything? I'm on Python 3.11 if that matters.
4 replies