File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,8 @@ INI File Contents::
7676Using ``django.conf.settings.configure() ``
7777------------------------------------------
7878
79- Django settings can be set up by calling ``django.conf.settings.configure() ``.
79+ In case there is no ``DJANGO_SETTINGS_MODULE ``, the ``settings `` object can be
80+ created by calling ``django.conf.settings.configure() ``.
8081
8182This can be done from your project's ``conftest.py `` file::
8283
@@ -85,6 +86,22 @@ This can be done from your project's ``conftest.py`` file::
8586 def pytest_configure():
8687 settings.configure(DATABASES=...)
8788
89+ Overriding individual settings
90+ ------------------------------
91+
92+ Settings can be overridden by using the :fixture: `settings ` fixture::
93+
94+ @pytest.fixture(autouse=True)
95+ def use_dummy_cache_backend(settings):
96+ settings.CACHES = {
97+ "default": {
98+ "BACKEND": "django.core.cache.backends.dummy.DummyCache",
99+ }
100+ }
101+
102+ Here `autouse=True ` is used, meaning the fixture is automatically applied to all tests,
103+ but it can also be requested individually per-test.
104+
88105Changing your app before Django gets set up
89106-------------------------------------------
90107
You can’t perform that action at this time.
0 commit comments