Skip to content

Commit 726a63f

Browse files
committed
Explain the order of where pytest-django finds DJANGO_SETTINGS_MODULE
This was changed before the 2.9.0 release and was not documented. The change is backward incompatible and may surprise users. Then change was originally made in pytest-dev#199.
1 parent 26c8aa8 commit 726a63f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

docs/changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ Compatibility
3030
* Drop support for Django 1.3. While pytest-django supports a wide range of
3131
Django versions, extended for Django 1.3 was dropped in february 2013.
3232

33+
* Settings defined in `pytest.ini`/`tox.ini`/`setup.cfg` used to override
34+
`DJANGO_SETTINGS_MODULE` defined in the environment. Previously the order was
35+
undocmented. Now, instead the settings from the environment will be used
36+
instead. If you previously relied on overriding the enviornment variable, you
37+
can instead specify `addopts = --ds=yourtestsettings` in the ini-file which
38+
will use the test settings. See `PR #199
39+
<https://github.com/pytest-dev/pytest-django/pull/199>`_.
40+
3341
2.8.0
3442
-----
3543

docs/configuring_django.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ Example contents of pytest.ini::
3838
[pytest]
3939
DJANGO_SETTINGS_MODULE = test_settings
4040

41+
Order of choosing settings
42+
--------------------------
43+
44+
If `--ds`, the environment variable and the pytest.ini configuration is used at
45+
the same time, pytest-django will first prefer using settings from the command
46+
line option `--ds`, then the environment variable and last the pytest.ini.
4147

4248
Using django-configurations
4349
---------------------------

0 commit comments

Comments
 (0)