Skip to content

Commit 48cf554

Browse files
committed
test: Run django tests with pytest, instead of needing 2 commands
1 parent 3d3b7f2 commit 48cf554

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,10 @@ jobs:
4949
python manage.py collectstatic
5050
python manage.py migrate
5151
python manage.py dashboard_import
52-
- name: Run non-django tests
52+
- name: Run tests
5353
env:
5454
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/test_database_name"
55-
run: pytest --cov .
56-
- name: Run django tests
57-
env:
58-
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/test_database_name"
59-
run: python manage.py test
55+
run: pytest .
6056
# - name: Coveralls
6157
# run: coveralls --service=github-actions
6258
# env:

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@ exclude = ["data", "gitout", "helpers/IATI-Rulesets", "helpers/schemas", "__pyca
1717
line-length = 119
1818
target-version = ["py312"]
1919
include = "^[^/]*\\.py|dashboard/.*\\.py$"
20+
21+
[tool.pytest.ini_options]
22+
DJANGO_SETTINGS_MODULE = "iati_dashboard.settings"
23+
python_files = ["tests.py", "test_*.py", "*_tests.py"]
24+
norecursedirs = ["*__pycache__*", "*.pytest_cache*"]
25+
console_output_style = "count"

pytest.ini

Lines changed: 0 additions & 4 deletions
This file was deleted.

requirements_dev.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-r requirements.txt
22
pytest
33
pytest-cov
4+
pytest-django
45
coveralls
56
flake8
67
flake8-pyproject

requirements_dev.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,11 @@ pytest==8.3.4
138138
# via
139139
# -r requirements_dev.in
140140
# pytest-cov
141+
# pytest-django
141142
pytest-cov==6.0.0
142143
# via -r requirements_dev.in
144+
pytest-django==4.10.0
145+
# via -r requirements_dev.in
143146
python-dateutil==2.9.0.post0
144147
# via
145148
# -r requirements.txt

0 commit comments

Comments
 (0)