@@ -78,28 +78,68 @@ commands = [
7878artifacts = []
7979
8080# >>> Hatch Test Suite <<<
81- [tool .hatch .envs .test ]
82- detached = true
81+ [tool .hatch .envs .hatch-test ]
8382extra-dependencies = [
83+ " pytest-sugar" ,
84+ " pytest-django" ,
8485 " playwright" ,
85- " twisted" ,
8686 " channels[daphne]>=4.0.0" ,
87+ " twisted" ,
8788 " tblib" ,
88- " whitenoise " , # TODO: Switch to ServeStatic
89+ " servestatic " ,
8990]
91+ matrix-name-format = " {variable}-{value}"
92+
93+ # Django 4.2
94+ [[tool .hatch .envs .hatch-test .matrix ]]
95+ python = [" 3.9" , " 3.10" , " 3.11" , " 3.12" ]
96+ django = [" 4.2" ]
97+
98+ # Django 5.0
99+ [[tool .hatch .envs .hatch-test .matrix ]]
100+ python = [" 3.10" , " 3.11" , " 3.12" ]
101+ django = [" 5.0" ]
102+
103+ # Django 5.1
104+ [[tool .hatch .envs .hatch-test .matrix ]]
105+ python = [" 3.10" , " 3.11" , " 3.12" , " 3.13" ]
106+ django = [" 5.1" ]
107+
108+ [tool .hatch .envs .hatch-test .overrides ]
109+ matrix.django.dependencies = [
110+ { if = [
111+ " 4.2" ,
112+ ], value = " django~=4.2" },
113+ { if = [
114+ " 5.0" ,
115+ ], value = " django~=5.0" },
116+ { if = [
117+ " 5.1" ,
118+ ], value = " django~=5.1" },
119+ ]
120+
121+ [tool .pytest .ini_options ]
122+ addopts = """ \
123+ --strict-config
124+ --strict-markers
125+ --reuse-db
126+ """
127+ django_find_project = false
128+ DJANGO_SETTINGS_MODULE = " test_app.settings_single_db"
129+ pythonpath = [" ." , " tests/" ]
90130
91- [tool .hatch .envs .test .scripts ]
92- python = [
93- " pip install -e . -U" ,
94- " playwright install chromium" ,
95- " cd tests && python manage.py test --noinput --settings='test_app.settings_single_db'" ,
96- " cd tests && python manage.py test --noinput --settings='test_app.settings_multi_db'" ,
131+
132+ # >>> Hatch Django Scripts <<<
133+ [tool .hatch .envs .django ]
134+ extra-dependencies = [" channels[daphne]>=4.0.0" , " twisted" , " servestatic" ]
135+
136+ [tool .hatch .envs .django .scripts ]
137+ runserver = [
138+ " cd tests && python manage.py migrate --noinput && python manage.py runserver" ,
97139]
98- runserver = [" cd tests && python manage.py runserver" ]
99140
100141
101142# >>> Hatch Documentation Scripts <<<
102-
103143[tool .hatch .envs .docs ]
104144template = " docs"
105145detached = true
@@ -138,7 +178,6 @@ detached = true
138178check = [" cd src/js && bun install && bun run check" ]
139179
140180# >>> Generic Tools <<<
141-
142181[tool .ruff ]
143182extend-exclude = [" */migrations/*" , " .venv/*" , " .eggs/*" , " .nox/*" , " build/*" ]
144183line-length = 120
@@ -156,9 +195,3 @@ lint.extend-ignore = [
156195]
157196lint.preview = true
158197lint.isort.known-first-party = [" src" , " tests" ]
159-
160- [tool .pytest .ini_options ]
161- addopts = """ \
162- --strict-config
163- --strict-markers
164- """
0 commit comments