Skip to content

Commit

Permalink
test: Run django tests with pytest, instead of needing 2 commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjwebb committed Feb 18, 2025
1 parent a9145c3 commit 99fbb49
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,10 @@ jobs:
python manage.py collectstatic
python manage.py migrate
python manage.py dashboard_import
- name: Run non-django tests
- name: Run tests
env:
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/test_database_name"
run: pytest --cov .
- name: Run django tests
env:
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/test_database_name"
run: python manage.py test
run: pytest .
# - name: Coveralls
# run: coveralls --service=github-actions
# env:
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ exclude = ["data", "gitout", "helpers/IATI-Rulesets", "helpers/schemas", "__pyca
line-length = 119
target-version = ["py312"]
include = "^[^/]*\\.py|dashboard/.*\\.py$"

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "iati_dashboard.settings"
python_files = ["tests.py", "test_*.py", "*_tests.py"]
norecursedirs = ["*__pycache__*", "*.pytest_cache*"]
console_output_style = "count"
4 changes: 0 additions & 4 deletions pytest.ini

This file was deleted.

1 change: 1 addition & 0 deletions requirements_dev.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-r requirements.txt
pytest
pytest-cov
pytest-django
coveralls
flake8
flake8-pyproject
Expand Down
3 changes: 3 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,11 @@ pytest==8.3.4
# via
# -r requirements_dev.in
# pytest-cov
# pytest-django
pytest-cov==6.0.0
# via -r requirements_dev.in
pytest-django==4.10.0
# via -r requirements_dev.in
python-dateutil==2.9.0.post0
# via
# -r requirements.txt
Expand Down

0 comments on commit 99fbb49

Please sign in to comment.