strong-toothbrush-37759
03/19/2022, 9:16 PMconftest.py
in one directory with a BUILD-file and in a deeper level you have more tests with their own BUILD-file, the usual “pytest” behavior would be to go up the folders and use all conftest.py
-Files up the tree. This is kind of obsolete with Pants, right? So I could either import the stuff I need from conftest.py
above into my tests, or define the python_test_utils
from “above” in my BUILD-file. Does this make sense? 😅refined-addition-53644
03/19/2022, 9:28 PMpython_test_utils
once at the top where the conftest.py
lives.strong-toothbrush-37759
03/19/2022, 9:32 PMstrong-toothbrush-37759
03/19/2022, 9:44 PMconftest.py
😩happy-kitchen-89482
03/19/2022, 10:02 PMstrong-toothbrush-37759
03/20/2022, 11:53 AMpytest-django
=> https://github.com/pytest-dev/pytest-django/issues/643strong-toothbrush-37759
03/20/2022, 2:21 PMconftest.py
in the root of our sources now:
@pytest.fixture(scope="session")
def django_db_modify_db_settings():
from django.conf import settings
pants_execution_slot = os.environ.get("PANTS_EXECUTION_SLOT", "")
default_test_db = settings.DATABASES["default"]
default_test_db["NAME"] = f"osiris_test{pants_execution_slot}"
Seems to work fine 👍
(important: this only works with pytest-django
)