@@ -38,6 +38,14 @@ Example contents of pytest.ini::
38
38
[pytest]
39
39
DJANGO_SETTINGS_MODULE = test.settings
40
40
41
+ ``pyproject.toml `` settings
42
+ ---------------------------
43
+
44
+ Example contents of pyproject.toml::
45
+
46
+ [tool.pytest.ini_options]
47
+ DJANGO_SETTINGS_MODULE = "test.settings"
48
+
41
49
Order of choosing settings
42
50
--------------------------
43
51
@@ -46,7 +54,7 @@ The order of precedence is, from highest to lowest:
46
54
* The command line option ``--ds ``
47
55
* The environment variable ``DJANGO_SETTINGS_MODULE ``
48
56
* The ``DJANGO_SETTINGS_MODULE `` option in the configuration file -
49
- ``pytest.ini ``, or other file that Pytest finds such as ``tox.ini ``
57
+ ``pytest.ini ``, or other file that Pytest finds such as ``tox.ini `` or `` pyproject.toml ``
50
58
51
59
If you want to use the highest precedence in the configuration file, you can
52
60
use ``addopts = --ds=yourtestsettings ``.
@@ -57,7 +65,7 @@ Using django-configurations
57
65
There is support for using `django-configurations <https://pypi.python.org/pypi/django-configurations/ >`_.
58
66
59
67
To do so configure the settings class using an environment variable, the
60
- ``--dc `` flag, or ``pytest.ini `` option ``DJANGO_CONFIGURATION ``.
68
+ ``--dc `` flag, ``pytest.ini `` option `` DJANGO_CONFIGURATION `` or `` pyproject.toml `` option ``DJANGO_CONFIGURATION ``.
61
69
62
70
Environment Variable::
63
71
@@ -73,6 +81,11 @@ INI File Contents::
73
81
[pytest]
74
82
DJANGO_CONFIGURATION=MySettings
75
83
84
+ pyproject.toml File Contents::
85
+
86
+ [tool.pytest.ini_options]
87
+ DJANGO_CONFIGURATION = "MySettings"
88
+
76
89
Using ``django.conf.settings.configure() ``
77
90
------------------------------------------
78
91
0 commit comments