Closed asottile-sentry closed 8 months ago
That’s a fun one! Hopefully using config.stash.get()
calls and acting only on non-None
values will be enough to fix the issue...
here's a minimal case:
==> t.py <==
WAT = 1
==> tests/__init__.py <==
==> tests/conftest.py <==
import os
def pytest_configure():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 't')
from django.conf import settings
settings.WAT
having a difficult time narrowing down a minimal example -- the repo involved is https://github.com/getsentry/sentry
I have figured out why it is happening and the stacktrace for it:
basically what's happening is the setup is skipped here: https://github.com/pytest-dev/pytest-django/blob/6cf63b65e86870abf68ae1f376398429e35864e7/pytest_django/plugin.py#L300-L301
normally it sets the thing that's being looked up here: https://github.com/pytest-dev/pytest-django/blob/6cf63b65e86870abf68ae1f376398429e35864e7/pytest_django/plugin.py#L358
which then fails to lookup here: https://github.com/pytest-dev/pytest-django/blob/6cf63b65e86870abf68ae1f376398429e35864e7/pytest_django/plugin.py#L238
something about sentry's
tests/conftest.py
initializes enough of django thatpytest-django
takes over. but since the setup has been skipped it fails to set up properly. I suspect that #238 is playing poorly with something.of note this worked before I upgraded
pytest-django
(I was previously on 4.4.0 and upgraded to 4.7.0 to get django 4.x support)will try and narrow down a smaller reproduction...