diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b6fb5cb8..51536858 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,8 +26,6 @@ jobs: permissions: contents: read security-events: write - env: - TOXENV: ${{ matrix.name }} steps: - uses: actions/checkout@v4 with: @@ -56,7 +54,9 @@ jobs: uv tool install tox==4.28.4 --with tox-uv - name: Run tox - run: tox + run: tox ${TOX_ARGS} + env: + TOX_ARGS: ${{ matrix.use_factor && format('-f {0}', matrix.name) || format('-e {0}', matrix.name) }} - name: Upload zizmor SARIF report into the GitHub repo code scanning if: contains(matrix.name, 'linting') @@ -77,79 +77,68 @@ jobs: fail-fast: false matrix: include: - - name: linting,docs - python: '3.13' - allow_failure: false - - # Explicitly test min pytest. - - name: py313-dj52-sqlite-pytestmin-coverage - python: '3.13' - allow_failure: false - - - name: py313-dj52-postgres-xdist-coverage - python: '3.13' - allow_failure: false - - - name: py313-dj51-postgres-xdist-coverage - python: '3.13' - allow_failure: false - - - name: py312-dj42-postgres-xdist-coverage - python: '3.12' - allow_failure: false - - - name: py311-dj50-postgres-xdist-coverage - python: '3.11' - allow_failure: false - - - name: py311-dj42-postgres-xdist-coverage - python: '3.11' - allow_failure: false - - - name: py310-dj52-postgres-xdist-coverage - python: '3.10' - allow_failure: false - - - name: py310-dj51-postgres-xdist-coverage - python: '3.10' - allow_failure: false - - - name: py310-dj42-postgres-xdist-coverage - python: '3.10' - allow_failure: false - - - name: py311-dj51-mysql-coverage - python: '3.11' - allow_failure: false - - - name: py310-dj42-mysql-coverage - python: '3.10' - allow_failure: false - - - name: py39-dj42-mysql-xdist-coverage - python: '3.9' - allow_failure: false - - - name: py313-djmain-sqlite-coverage - python: '3.13' - allow_failure: true - - - name: py313-dj52-sqlite-coverage - python: '3.13' - allow_failure: true - - - name: py312-dj51-sqlite-xdist-coverage - python: '3.12' - allow_failure: false - - - name: py311-dj42-sqlite-xdist-coverage - python: '3.11' - allow_failure: false - - # pypy3: not included with coverage reports (much slower then). - - name: pypy3-dj42-postgres - python: 'pypy3.9' - allow_failure: false + - name: linting,docs + python: '3.13' + allow_failure: false + use_factor: false + + - name: py39-sqlite-xdist-coverage + python: '3.9' + allow_failure: false + use_factor: true + + - name: py310-sqlite-xdist-coverage + python: '3.10' + allow_failure: false + use_factor: true + + - name: py311-sqlite-xdist-coverage + python: '3.11' + allow_failure: false + use_factor: true + + # start: Speeding up tests by running them in parallel. + - name: py312-dj42-sqlite-xdist-coverage + python: '3.12' + allow_failure: false + use_factor: false + + - name: py312-dj51-sqlite-xdist-coverage + python: '3.12' + allow_failure: false + use_factor: false + + - name: py312-dj52-sqlite-xdist-coverage + python: '3.12' + allow_failure: false + use_factor: false + # end: Speeding up tests by running them in parallel. + + - name: py313-sqlite-xdist-coverage + python: '3.13' + allow_failure: false + use_factor: true + + - name: py313-djmain-postgres-coverage + python: '3.13' + allow_failure: false + use_factor: false + + - name: py313-djmain-mysql-coverage + python: '3.13' + allow_failure: false + use_factor: false + + - name: py313-djmain-sqlite-pytestmin + python: '3.13' + allow_failure: false + use_factor: false + + # pypy3: not included with coverage reports (much slower then). + - name: pypy3-dj52-sqlite + python: 'pypy3.11' + allow_failure: false + use_factor: false check: # This job does nothing and is only used for the branch protection if: always() diff --git a/pyproject.toml b/pyproject.toml index 75915cc8..56c1ff11 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -122,6 +122,9 @@ include = [ "pytest_django_test/*", "tests/*", ] +omit = [ + "pytest_django/_version.py", # coverage fails when the file stops existing randomly, see .gitignore +] skip_covered = true exclude_lines = [ "pragma: no cover", diff --git a/tox.ini b/tox.ini index 5ffeeead..a9b99641 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] envlist = - py313-dj{main,52,51}-postgres - py312-dj{main,52,51,42}-postgres - py311-dj{main,52,51,42}-postgres - py310-dj{main,52,51,42}-postgres - py39-dj42-postgres + py313-dj{main,52,51}-{sqlite,postgres,mysql}-{xdist}-{coverage} + py312-dj{main,52,51,42}-{sqlite,postgres,mysql}-{xdist}-{coverage} + py{py,}311-dj{52,51,42}-{sqlite,postgres,mysql}-{xdist}-{coverage} + py{py,}310-dj{52,51,42}-{sqlite,postgres,mysql}-{xdist}-{coverage} + py{py,}39-dj42-{sqlite,postgres,mysql}-{xdist}-{coverage} linting [testenv] @@ -16,17 +16,19 @@ dependency_groups = xdist: xdist deps = djmain: https://github.com/django/django/archive/main.tar.gz - dj52: Django>=5.2a1,<6.0 + dj52: Django>=5.2,<6.0 dj51: Django>=5.1,<5.2 dj50: Django>=5.0,<5.1 dj42: Django>=4.2,<4.3 + pytestmin: pytest>=7.0,<7.1 setenv = - mysql: DJANGO_SETTINGS_MODULE=pytest_django_test.settings_mysql + mysql: DJANGO_SETTINGS_MODULE=pytest_django_test.settings_mysql postgres: DJANGO_SETTINGS_MODULE=pytest_django_test.settings_postgres sqlite: DJANGO_SETTINGS_MODULE=pytest_django_test.settings_sqlite sqlite_file: DJANGO_SETTINGS_MODULE=pytest_django_test.settings_sqlite_file + xdist: PYTEST_ADDOPTS=-n auto coverage: PYTESTDJANGO_TEST_RUNNER=coverage run -m pytest coverage: COVERAGE_PROCESS_START={toxinidir}/pyproject.toml