Testing¶
OpenSESA uses pytest with Django settings from app.settings_test.
Collect Tests¶
docker compose run --rm app sh -c "DJANGO_SETTINGS_MODULE=app.settings_test PYTHONPATH=. pytest --collect-only -q"
Run Full Suite¶
Targeted Test Execution¶
# Run a specific module
docker compose run --rm app sh -c "DJANGO_SETTINGS_MODULE=app.settings_test PYTHONPATH=. pytest app/requirements_mgmt/tests -q"
# Run by marker
docker compose run --rm app sh -c "DJANGO_SETTINGS_MODULE=app.settings_test PYTHONPATH=. pytest -m \"not slow\" -q"
# Run a single test case
docker compose run --rm app sh -c "DJANGO_SETTINGS_MODULE=app.settings_test PYTHONPATH=. pytest app/core/tests/test_views.py::TestClass::test_method -q"
Coverage Requirements¶
Coverage threshold is configured in pytest.ini with:
--cov=app--cov-fail-under=70
Test Organization¶
Tests are located under domain app folders, for example:
app/core/tests/app/requirements_mgmt/tests/app/sysarch_mgmt/tests/
For failing local test runs, check the Troubleshooting Matrix.
Collapsed failure triage
If failures appear only in full-suite runs, investigate shared state, fixture coupling, and implicit ordering assumptions.