-
Notifications
You must be signed in to change notification settings - Fork 346
RecursionError when mixing use of override_settings and settings fixture #809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In practice, I've worked around this by wrapping @pytest.fixture
def settings(settings):
with override_settings():
yield settings
settings.finalize() |
Out of curiosity, can't you replace |
One valid reason not to use the |
looks like you could want a settings_session and settings_module and settings_class for each of the scopes |
This is exactly why. We have a session-scoped fixture running a live test server thread, whose handler must be setup and torn down in a specific order for each participating test. |
Because the
settings
fixture undoes its modifications once at fixture teardown, ifoverride_settings
is used aftersettings
fixture setup, but before anysettings.VAL = 1
setattr statements, thesettings
fixture will end up restoringdjango.conf.settings._wrapped
to the fake settings installed byoverride_settings
.After a critical amount of tests where this occurs, Python will raise a
RecursionError
on any attribute access todjango.conf.settings
.Here's a minimal example to show what's going on:
And a test to surface the RecursionError:
The text was updated successfully, but these errors were encountered: