lemon-helicopter-73409
03/09/2023, 4:53 PMImportError: No module named 'config'
pytest-django could not find a Django project (no manage.py file could be found). You must explicitly add your Django project to the Python path to have it picked up.
Somehow pytest-django can’t figure out where config/settings
is? Any help is appreciated!happy-kitchen-89482
03/09/2023, 5:18 PMlemon-helicopter-73409
03/09/2023, 5:23 PMconfig
module in the pytest-django plugin before it ever gets to the conftest.py, but I could be wrong.config
, mtom
and manage.py
are at the top level of the repo, and mtom/BUILD
is where I set the python_tests
target.conftest.py
filehappy-kitchen-89482
03/09/2023, 5:39 PMlemon-helicopter-73409
03/09/2023, 5:40 PMdependencies=['config']
to the python_tests
happy-kitchen-89482
03/09/2023, 5:42 PMconftest.py
is useful for loading different settings in different tests, but for now there are also other ways to tell pytest-django about your settings, e.g., in an env var (that you will have to punch through to the test via this option: https://www.pantsbuild.org/docs/reference-subprocess-environment#env_varslemon-helicopter-73409
03/09/2023, 5:44 PMhappy-kitchen-89482
03/09/2023, 6:01 PMlemon-helicopter-73409
03/09/2023, 6:02 PMdependencies=["//:req", 'config'],
and give the python_tests
target a name…happy-kitchen-89482
03/09/2023, 10:26 PM