Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

[run]
source = opal
; include = opal/*
omit =
.*,
**/tests/*,
# **/migrations/*,
opal/wsgi.py,
opal/asgi.py,
# omit prod settings
opal/settings_prod.py,
# omit sidebar menu
opal/templates/sidebar_menu.html,
opal/templates/components/menu_group.html,
opal/templates/components/menu_item.html
branch = True
plugins =
django_coverage_plugin

[report]
fail_under = 100
precision = 2
show_missing = True
skip_empty = True
skip_covered = True
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't require coverage on TYPE_CHECKING imports
if TYPE_CHECKING:

# Don't complain if non-runnable code isn't run:
if __name__ == .__main__.:
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,17 @@ jobs:
# generate secret key
SECRET_KEY=$(python -c "import secrets; print(secrets.token_urlsafe())")
sed -i "s/^SECRET_KEY=.*/SECRET_KEY=$SECRET_KEY/" .env
MYSQL_PWD=$DB_ROOT_PASSWORD mariadb -u root -h db --skip-ssl -e "GRANT ALL PRIVILEGES ON \`test_OpalDB\`.* TO \`$DB_USER\`@\`%\`;"
MYSQL_PWD=$DB_ROOT_PASSWORD mariadb -u root -h db --skip-ssl -e "GRANT ALL PRIVILEGES ON \`test_QuestionnaireDB\`.* TO \`$DB_USER\`@\`%\`;"
MYSQL_PWD=$DB_ROOT_PASSWORD mariadb -u root -h db --skip-ssl -e "GRANT ALL PRIVILEGES ON \`test_opal%\`.* TO \`$DB_USER\`@\`%\`;"
MYSQL_PWD=$DB_ROOT_PASSWORD mariadb -u root -h db --skip-ssl -e "GRANT ALL PRIVILEGES ON \`test_OpalDB%\`.* TO \`$DB_USER\`@\`%\`;"
MYSQL_PWD=$DB_ROOT_PASSWORD mariadb -u root -h db --skip-ssl -e "GRANT ALL PRIVILEGES ON \`test_QuestionnaireDB%\`.* TO \`$DB_USER\`@\`%\`;"
- name: Run pytest
env:
# https://github.com/zupo/awesome-pytest-speedup#pythondontwritebytecode
PYTHONDONTWRITEBYTECODE: 1
run: |
uv run pytest --version
# -m "" runs all tests, even the ones marked as slow
uv run coverage run -m pytest -m "" -v --junitxml=test-report.xml
uv run pytest --cov=opal -n auto -m "" --junitxml=test-report.xml
# see: https://github.com/dorny/test-reporter/issues/244
# - name: Publish Test Results
# uses: dorny/[email protected]
Expand Down Expand Up @@ -237,6 +241,6 @@ jobs:
permissions:
contents: read
packages: write
uses: opalmedapps/.github/.github/workflows/docker-build.yaml@fix-build
uses: opalmedapps/.github/.github/workflows/docker-build.yaml@main
with:
test-command: python manage.py
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
permissions:
contents: read
packages: write
uses: opalmedapps/.github/.github/workflows/docker-build.yaml@fix-build
uses: opalmedapps/.github/.github/workflows/docker-build.yaml@main
with:
test-command: python manage.py
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ dev = [
"pandas-stubs==2.2.3.250308",
"pre-commit==4.2.0",
"pytest==8.3.5",
# for proper coverage support with pytest-xdist
"pytest-cov==6.1.1",
"pytest-django==4.11.1",
"pytest-mock==3.14.0",
"pytest-randomly==3.16.0",
"pytest-socket==0.7.0",
"pytest-sugar==1.0.0",
"pytest-xdist==3.6.1",
"ruff==0.11.4",
"types-beautifulsoup4==4.12.0.20250204",
"types-fpdf2==2.8.2.20250318",
Expand Down
34 changes: 0 additions & 34 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,37 +44,3 @@ warn_unreachable = False

[mypy-*.factories]
disallow_untyped_calls = False

[coverage:run]
source = opal
; include = opal/*
omit =
.*,
**/tests/*,
# **/migrations/*,
opal/wsgi.py,
opal/asgi.py,
# omit prod settings
opal/settings_prod.py,
# omit sidebar menu
opal/templates/sidebar_menu.html,
opal/templates/components/menu_group.html,
opal/templates/components/menu_item.html
branch = True
plugins =
django_coverage_plugin

[coverage:report]
fail_under = 100
precision = 2
show_missing = True
skip_empty = True
skip_covered = True
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't require coverage on TYPE_CHECKING imports
if TYPE_CHECKING:

# Don't complain if non-runnable code isn't run:
if __name__ == .__main__.:
39 changes: 39 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.