From 82180a575a90ce48fb0d5c2999d64692808d298c Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 09:24:48 -0400 Subject: [PATCH 01/34] Unify tests for speed --- .github/workflows/main.yml | 71 +++++++++++--------------------------- 1 file changed, 21 insertions(+), 50 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a2258739..6b1ab294 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,75 +33,46 @@ jobs: python: '3.13' allow_failure: false - # Explicitly test min pytest. - - name: py313-dj52-sqlite-pytestmin-coverage + - name: py313-sqlite-xdist-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 + - name: py312-sqlite-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 + - name: py311-sqlite-xdist-coverage python: '3.11' allow_failure: false - - name: py310-dj42-mysql-coverage + - name: py310-sqlite-xdist-coverage python: '3.10' allow_failure: false - - name: py39-dj42-mysql-xdist-coverage + - name: py39-sqlite-xdist-coverage python: '3.9' allow_failure: false - - name: py313-djmain-sqlite-coverage - python: '3.13' - allow_failure: true + # - name: py313-sqlite-coverage + # python: '3.13' + # allow_failure: true - - name: py313-dj52-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: py312-dj51-sqlite-xdist-coverage + # python: '3.12' + # allow_failure: false - - name: py311-dj42-sqlite-xdist-coverage - python: '3.11' - allow_failure: false + # - name: py313-mysql-xdist-coverage + # python: '3.13' + # allow_failure: false - # pypy3: not included with coverage reports (much slower then). - - name: pypy3-dj42-postgres - python: 'pypy3.9' - allow_failure: false + # # pypy3: not included with coverage reports (much slower then). + # - name: pypy3-dj42-postgres + # python: 'pypy3.9' + # allow_failure: false steps: - uses: actions/checkout@v4 with: From f33ffd9c434f7af8974eaab87e3d0e34384056b2 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 09:43:25 -0400 Subject: [PATCH 02/34] . --- .github/workflows/main.yml | 4 ++-- tox.ini | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6b1ab294..c7595149 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -97,8 +97,8 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install tox==4.26.0 + python -m pip install uv + uv tool install tox==4.26.0 --with tox-uv - name: Run tox run: tox -e ${{ matrix.name }} diff --git a/tox.ini b/tox.ini index 410daf2d..336fcd55 100644 --- a/tox.ini +++ b/tox.ini @@ -11,7 +11,7 @@ envlist = extras = testing 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 From f6fe9cbce9608ca0b24c404a33ce55cc0261032e Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 09:49:26 -0400 Subject: [PATCH 03/34] . --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 336fcd55..a6af5a77 100644 --- a/tox.ini +++ b/tox.ini @@ -26,10 +26,11 @@ deps = xdist: pytest-xdist>=1.15 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 From 81c2e36325bf6436ce6680cc3f7b48aa8278003b Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 09:56:04 -0400 Subject: [PATCH 04/34] Add pytest import skip for xdist in test_fixtures.py to ensure compatibility --- tests/test_fixtures.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py index 709ae6c9..a8c3d6ce 100644 --- a/tests/test_fixtures.py +++ b/tests/test_fixtures.py @@ -444,6 +444,7 @@ def test_set_non_existent(settings): class TestLiveServer: def test_settings_before(self) -> None: + pytest.importorskip("xdist") from django.conf import settings assert ( @@ -460,6 +461,7 @@ def test_change_settings(self, live_server, settings) -> None: def test_settings_restored(self) -> None: """Ensure that settings are restored after test_settings_before.""" + pytest.importorskip("xdist") from django.conf import settings assert TestLiveServer._test_settings_before_run is True # type: ignore[attr-defined] From 447de77ccca5f69a24d05905991fb46d34859c9a Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 10:03:38 -0400 Subject: [PATCH 05/34] . --- tests/test_fixtures.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py index a8c3d6ce..4fadcde2 100644 --- a/tests/test_fixtures.py +++ b/tests/test_fixtures.py @@ -4,6 +4,7 @@ fixtures are tested in test_database. """ +import os import socket from collections.abc import Generator from contextlib import contextmanager @@ -443,8 +444,8 @@ def test_set_non_existent(settings): class TestLiveServer: + @pytest.mark.skipif("PYTEST_XDIST_WORKER" in os.environ, reason="xdist in use") def test_settings_before(self) -> None: - pytest.importorskip("xdist") from django.conf import settings assert ( @@ -459,9 +460,9 @@ def test_url(self, live_server) -> None: def test_change_settings(self, live_server, settings) -> None: assert live_server.url == force_str(live_server) + @pytest.mark.skipif("PYTEST_XDIST_WORKER" in os.environ, reason="xdist in use") def test_settings_restored(self) -> None: """Ensure that settings are restored after test_settings_before.""" - pytest.importorskip("xdist") from django.conf import settings assert TestLiveServer._test_settings_before_run is True # type: ignore[attr-defined] From 5c748762307286eb04875bd7516f875ffca0f461 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 10:13:21 -0400 Subject: [PATCH 06/34] . --- tox.ini | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index a6af5a77..34e2475f 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} + py312-dj{main,52,51,42} + py311-dj{main,52,51,42} + py310-dj{main,52,51,42} + py39-dj42 linting [testenv] From 17fc9c07c1c6f4df8c83870e1ec0fcbb59d15620 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 10:30:44 -0400 Subject: [PATCH 07/34] All these tests now run in 68s... damn! --- tox.ini | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index 34e2475f..1dd8e9d5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] envlist = - py313-dj{main,52,51} - py312-dj{main,52,51,42} - py311-dj{main,52,51,42} - py310-dj{main,52,51,42} - py39-dj42 + py313-dj{main,52,51}-sqlite-xdist + py312-dj{main,52,51,42}-sqlite-xdist + py311-dj{52,51,42}-sqlite-xdist + py310-dj{52,51,42}-sqlite-xdist + py39-dj42-sqlite-xdist linting [testenv] From ec939d5c00c4f07046b211e48fc79c62a5dbdd3a Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 10:54:59 -0400 Subject: [PATCH 08/34] . --- tox.ini | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index 1dd8e9d5..b6e41ff1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] envlist = - py313-dj{main,52,51}-sqlite-xdist - py312-dj{main,52,51,42}-sqlite-xdist - py311-dj{52,51,42}-sqlite-xdist - py310-dj{52,51,42}-sqlite-xdist - py39-dj42-sqlite-xdist + py313-dj{main,52,51}-{sqlite,postgres,mysql}-xdist-coverage + py312-dj{main,52,51,42}-{sqlite,postgres,mysql}-xdist-coverage + py311-dj{52,51,42}-{sqlite,postgres,mysql}-xdist-coverage + py310-dj{52,51,42}-{sqlite,postgres,mysql}-xdist-coverage + py39-dj42-{sqlite,postgres,mysql}-xdist-coverage linting [testenv] From bbe8909d3d0bc9eea9925639cb60ddc9081ade74 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 10:59:39 -0400 Subject: [PATCH 09/34] Refactor tox commands in tox.ini and update workflow to use the -f flag for improved functionality. --- .github/workflows/main.yml | 3 ++- tox.ini | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c7595149..e6d2b5b2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -101,7 +101,8 @@ jobs: uv tool install tox==4.26.0 --with tox-uv - name: Run tox - run: tox -e ${{ matrix.name }} + run: | + tox -f ${{ matrix.name }} - name: Prepare coverage file for upload if: contains(matrix.name, 'coverage') diff --git a/tox.ini b/tox.ini index b6e41ff1..7d8ab4db 100644 --- a/tox.ini +++ b/tox.ini @@ -40,9 +40,7 @@ setenv = passenv = PYTEST_ADDOPTS,TERM,TEST_DB_USER,TEST_DB_PASSWORD,TEST_DB_HOST usedevelop = True commands = - coverage: coverage erase {env:PYTESTDJANGO_TEST_RUNNER:pytest} {posargs:tests} - coverage: coverage combine [testenv:linting] extras = From 18abc2b15e9aa4d07bc9b47856f04f01fd707004 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 11:03:27 -0400 Subject: [PATCH 10/34] . --- .github/workflows/main.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e6d2b5b2..3a0d4a14 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -101,20 +101,22 @@ jobs: uv tool install tox==4.26.0 --with tox-uv - name: Run tox + shell: bash run: | - tox -f ${{ matrix.name }} - - - name: Prepare coverage file for upload - if: contains(matrix.name, 'coverage') - run: mv .coverage coverage.${{ matrix.name }} + if [[ ${{ matrix.name }} == *","* ]]; then + tox -e ${{ matrix.name }} + else + tox -f ${{ matrix.name }} + fi - name: Upload temporary coverage artifact if: contains(matrix.name, 'coverage') uses: actions/upload-artifact@v4 with: name: coverage-artifact-${{ matrix.name }} - path: coverage.${{ matrix.name }} + path: .coverage.* retention-days: 1 + include-hidden-files: true report-coverage: name: Report Combined Coverage From 9226882d07685c6875a2c07f7fb2cc680bc82f76 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 12:29:31 -0400 Subject: [PATCH 11/34] . --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3a0d4a14..e98e775e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -147,7 +147,7 @@ jobs: - name: Combine coverage reports run: | mkdir combined_coverage_data - find downloaded-coverage-artifacts -type f -name 'coverage.*' -exec cp {} combined_coverage_data/ \; + find downloaded-coverage-artifacts -type f -name '.coverage.*' -exec cp {} combined_coverage_data/ \; coverage combine combined_coverage_data/* coverage xml coverage html From 99ffdc4a3d799471547f844b35d2905279eff563 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 12:36:57 -0400 Subject: [PATCH 12/34] simpler... --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e98e775e..15da489a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -146,9 +146,7 @@ jobs: - name: Combine coverage reports run: | - mkdir combined_coverage_data - find downloaded-coverage-artifacts -type f -name '.coverage.*' -exec cp {} combined_coverage_data/ \; - coverage combine combined_coverage_data/* + coverage combine coverage xml coverage html coverage report --format=markdown >> $GITHUB_STEP_SUMMARY From 7e0c82bc7d9b0258fa87d82f61d26d2c7b5c0cb8 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 12:42:47 -0400 Subject: [PATCH 13/34] . --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 15da489a..f154f3d5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -146,6 +146,7 @@ jobs: - name: Combine coverage reports run: | + ls -lash coverage combine coverage xml coverage html From 94af1289277214e3f740da234d3b0adf3978b351 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 12:49:44 -0400 Subject: [PATCH 14/34] . --- .github/workflows/main.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f154f3d5..2c2a029d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,26 +32,32 @@ jobs: - name: linting,docs python: '3.13' allow_failure: false + use_factor: False - name: py313-sqlite-xdist-coverage python: '3.13' allow_failure: false + use_factor: True - name: py312-sqlite-xdist-coverage python: '3.12' allow_failure: false + use_factor: True - name: py311-sqlite-xdist-coverage python: '3.11' allow_failure: false + use_factor: True - name: py310-sqlite-xdist-coverage python: '3.10' allow_failure: false + use_factor: True - name: py39-sqlite-xdist-coverage python: '3.9' allow_failure: false + use_factor: True # - name: py313-sqlite-coverage # python: '3.13' @@ -101,13 +107,7 @@ jobs: uv tool install tox==4.26.0 --with tox-uv - name: Run tox - shell: bash - run: | - if [[ ${{ matrix.name }} == *","* ]]; then - tox -e ${{ matrix.name }} - else - tox -f ${{ matrix.name }} - fi + run: tox ${{ matrix.use_factor && '-f' || '-e' }} ${{ matrix.name }} - name: Upload temporary coverage artifact if: contains(matrix.name, 'coverage') @@ -146,8 +146,8 @@ jobs: - name: Combine coverage reports run: | - ls -lash - coverage combine + ls -lash downloaded-coverage-artifacts + coverage combine downloaded-coverage-artifacts coverage xml coverage html coverage report --format=markdown >> $GITHUB_STEP_SUMMARY From 2506c026cef67ed53d370b2ee2440016d99fba5e Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 14:48:58 -0400 Subject: [PATCH 15/34] . --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2c2a029d..c8cb5446 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -141,13 +141,13 @@ jobs: - name: Download all coverage artifacts uses: actions/download-artifact@v4 with: - path: downloaded-coverage-artifacts + path: . pattern: coverage-artifact-* - name: Combine coverage reports run: | - ls -lash downloaded-coverage-artifacts - coverage combine downloaded-coverage-artifacts + ls -lash coverage-artifact-* + coverage combine coverage-artifact-* coverage xml coverage html coverage report --format=markdown >> $GITHUB_STEP_SUMMARY From 980a1ab895f68587a51c5002fc24feb2228c4f56 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 14:59:43 -0400 Subject: [PATCH 16/34] . --- pyproject.toml | 2 +- tox.ini | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2247e90e..bc5ca806 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,7 +95,7 @@ ignore_missing_imports = true [tool.coverage.run] parallel = true -source = ["${PYTESTDJANGO_COVERAGE_SRC}."] +source = ["pytest_django"] branch = true [tool.coverage.report] include = [ diff --git a/tox.ini b/tox.ini index 7d8ab4db..33a4b333 100644 --- a/tox.ini +++ b/tox.ini @@ -35,7 +35,6 @@ setenv = coverage: PYTESTDJANGO_TEST_RUNNER=coverage run -m pytest coverage: COVERAGE_PROCESS_START={toxinidir}/pyproject.toml coverage: COVERAGE_FILE={toxinidir}/.coverage - coverage: PYTESTDJANGO_COVERAGE_SRC={toxinidir}/ passenv = PYTEST_ADDOPTS,TERM,TEST_DB_USER,TEST_DB_PASSWORD,TEST_DB_HOST usedevelop = True From 8f26903b58e0ee7f7fad3aee9e8e7bf870081fbe Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 14:59:58 -0400 Subject: [PATCH 17/34] . --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c8cb5446..472abc9e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -146,7 +146,6 @@ jobs: - name: Combine coverage reports run: | - ls -lash coverage-artifact-* coverage combine coverage-artifact-* coverage xml coverage html From 291e5414e2ab7941970c99bcbede48e7bedf7bb3 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 15:12:18 -0400 Subject: [PATCH 18/34] more... --- .github/workflows/main.yml | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 472abc9e..07de829b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,26 +59,21 @@ jobs: allow_failure: false use_factor: True - # - name: py313-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: py313-mysql-xdist-coverage - # python: '3.13' - # allow_failure: false - - # # pypy3: not included with coverage reports (much slower then). - # - name: pypy3-dj42-postgres - # python: 'pypy3.9' - # allow_failure: false + - name: py313-postgres-xdist-coverage + python: '3.13' + allow_failure: false + use_factor: True + + - name: py313-mysql-xdist-coverage + python: '3.13' + allow_failure: false + use_factor: True + + # pypy3: not included with coverage reports (much slower then). + - name: pypy3-djmain-sqlite + python: 'pypy3.9' + allow_failure: false + use_factor: False steps: - uses: actions/checkout@v4 with: From 278eb9417001ffc38edcfcbcfe02ba94c0151d72 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 15:33:17 -0400 Subject: [PATCH 19/34] . --- .github/workflows/main.yml | 2 +- tox.ini | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 07de829b..e72bca41 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -71,7 +71,7 @@ jobs: # pypy3: not included with coverage reports (much slower then). - name: pypy3-djmain-sqlite - python: 'pypy3.9' + python: 'pypy3.11' allow_failure: false use_factor: False steps: diff --git a/tox.ini b/tox.ini index 33a4b333..0db5efd5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] envlist = - py313-dj{main,52,51}-{sqlite,postgres,mysql}-xdist-coverage - py312-dj{main,52,51,42}-{sqlite,postgres,mysql}-xdist-coverage - py311-dj{52,51,42}-{sqlite,postgres,mysql}-xdist-coverage - py310-dj{52,51,42}-{sqlite,postgres,mysql}-xdist-coverage - py39-dj42-{sqlite,postgres,mysql}-xdist-coverage + 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] From d5ca2d0d5d2cfba280e288561aa20a3f786708bc Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 15:36:18 -0400 Subject: [PATCH 20/34] . --- .github/workflows/main.yml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e72bca41..c004502f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,48 +32,53 @@ jobs: - name: linting,docs python: '3.13' allow_failure: false - use_factor: False + use_factor: true - name: py313-sqlite-xdist-coverage python: '3.13' allow_failure: false - use_factor: True + use_factor: true - name: py312-sqlite-xdist-coverage python: '3.12' allow_failure: false - use_factor: True + use_factor: true - name: py311-sqlite-xdist-coverage python: '3.11' allow_failure: false - use_factor: True + use_factor: true - name: py310-sqlite-xdist-coverage python: '3.10' allow_failure: false - use_factor: True + use_factor: true - name: py39-sqlite-xdist-coverage python: '3.9' allow_failure: false - use_factor: True + use_factor: true - - name: py313-postgres-xdist-coverage + - name: py313-djmain-postgres-coverage python: '3.13' allow_failure: false - use_factor: True + use_factor: false - - name: py313-mysql-xdist-coverage + - name: py313-djmain-mysql-coverage python: '3.13' allow_failure: false - use_factor: True + 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-djmain-sqlite python: 'pypy3.11' allow_failure: false - use_factor: False + use_factor: false steps: - uses: actions/checkout@v4 with: From 7aeb0a492c6b76b82655c48c6e9e5f72cf130935 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 15:42:05 -0400 Subject: [PATCH 21/34] . --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c004502f..31f278ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,6 +106,12 @@ jobs: python -m pip install uv uv tool install tox==4.26.0 --with tox-uv + - name: Debug tox command + run: | + echo "matrix.use_factor is: ${{ matrix.use_factor }}" + echo "Calculated tox command part: ${{ matrix.use_factor && '-f' || '-e' }}" + echo "Full tox command: tox ${{ matrix.use_factor && '-f' || '-e' }} ${{ matrix.name }}" + - name: Run tox run: tox ${{ matrix.use_factor && '-f' || '-e' }} ${{ matrix.name }} From e1aabb37c02bd76212559e77967ff9a5d04b134e Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 15:43:15 -0400 Subject: [PATCH 22/34] . --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 31f278ec..618699c5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,7 +32,7 @@ jobs: - name: linting,docs python: '3.13' allow_failure: false - use_factor: true + use_factor: false - name: py313-sqlite-xdist-coverage python: '3.13' From 3768ab8b19cc635c56a71a55b7841b10ecb16d28 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 15:52:02 -0400 Subject: [PATCH 23/34] . --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 0db5efd5..85caf353 100644 --- a/tox.ini +++ b/tox.ini @@ -2,9 +2,9 @@ envlist = 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} + 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] From e7201f9c50b40ea4a2eebccee553d7fbc4a723af Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 15:55:23 -0400 Subject: [PATCH 24/34] . --- .github/workflows/main.yml | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 618699c5..15e590b5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -75,7 +75,7 @@ jobs: use_factor: false # pypy3: not included with coverage reports (much slower then). - - name: pypy3-djmain-sqlite + - name: pypy3-dj52-sqlite python: 'pypy3.11' allow_failure: false use_factor: false diff --git a/tox.ini b/tox.ini index 85caf353..5811a9ba 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ deps = dj50: Django>=5.0,<5.1 dj42: Django>=4.2,<4.3 - mysql: mysqlclient==2.1.0 + mysql: mysqlclient==2.2.7 postgres: psycopg[binary] coverage: coverage[toml] From c7c0d9f00b679aa2ea012d9e5baf86901045b761 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 16:19:36 -0400 Subject: [PATCH 25/34] . --- .github/workflows/main.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 15e590b5..4d3d90d5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,10 +39,27 @@ jobs: allow_failure: false use_factor: true - - name: py312-sqlite-xdist-coverage + # start:Speeding up tests by running them in parallel. + - name: py312-djmain-sqlite-xdist-coverage python: '3.12' allow_failure: false - use_factor: true + use_factor: false + + - name: py312-dj52-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-dj42-sqlite-xdist-coverage + python: '3.12' + allow_failure: false + use_factor: false + # end: Speeding up tests by running them in parallel. - name: py311-sqlite-xdist-coverage python: '3.11' From 2b040cb68f753c8611ded2757e6185f412e3ad9b Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Tue, 27 May 2025 16:27:31 -0400 Subject: [PATCH 26/34] . --- .github/workflows/main.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4d3d90d5..81366166 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -123,12 +123,6 @@ jobs: python -m pip install uv uv tool install tox==4.26.0 --with tox-uv - - name: Debug tox command - run: | - echo "matrix.use_factor is: ${{ matrix.use_factor }}" - echo "Calculated tox command part: ${{ matrix.use_factor && '-f' || '-e' }}" - echo "Full tox command: tox ${{ matrix.use_factor && '-f' || '-e' }} ${{ matrix.name }}" - - name: Run tox run: tox ${{ matrix.use_factor && '-f' || '-e' }} ${{ matrix.name }} From 36344acff4cca14780b610b4007cec418b6b332e Mon Sep 17 00:00:00 2001 From: Javier Buzzi Date: Thu, 5 Jun 2025 17:00:29 -0400 Subject: [PATCH 27/34] Update main.yml --- .github/workflows/main.yml | 140 ++++++++++++++++++------------------- 1 file changed, 67 insertions(+), 73 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8ad3f9d8..ab173dcd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -82,79 +82,73 @@ 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: py313-sqlite-xdist-coverage + python: '3.13' + allow_failure: false + use_factor: true + + # start:Speeding up tests by running them in parallel. + - name: py312-djmain-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 + + - name: py312-dj51-sqlite-xdist-coverage + python: '3.12' + allow_failure: false + use_factor: false + + - name: py312-dj42-sqlite-xdist-coverage + python: '3.12' + allow_failure: false + use_factor: false + # end: Speeding up tests by running them in parallel. + + - name: py311-sqlite-xdist-coverage + python: '3.11' + allow_failure: false + use_factor: true + + - name: py310-sqlite-xdist-coverage + python: '3.10' + allow_failure: false + use_factor: true + + - name: py39-sqlite-xdist-coverage + python: '3.9' + 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 report-coverage: name: Report Combined Coverage From 2ed43eb71d74d7d0e5ec207fda1209a4df9d9362 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Thu, 5 Jun 2025 17:19:37 -0400 Subject: [PATCH 28/34] . --- .github/workflows/main.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ab173dcd..a54aff5b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,10 +65,6 @@ jobs: sarif_file: zizmor.sarif category: zizmor - - name: Prepare coverage file for upload - if: contains(matrix.name, 'coverage') - run: mv .coverage coverage.${TOXENV} - - name: Upload temporary coverage artifact if: contains(matrix.name, 'coverage') uses: actions/upload-artifact@v4 From b5f158d7451ec9c70ae4650430d732957dd3badf Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Thu, 5 Jun 2025 17:30:50 -0400 Subject: [PATCH 29/34] . --- pyproject.toml | 2 +- tox.ini | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e38b07fb..29acbf43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -113,7 +113,7 @@ ignore_missing_imports = true [tool.coverage.run] parallel = true -source = ["pytest_django"] +source = ["${PYTESTDJANGO_COVERAGE_SRC}."] branch = true [tool.coverage.report] include = [ diff --git a/tox.ini b/tox.ini index e7598ece..edcb30ab 100644 --- a/tox.ini +++ b/tox.ini @@ -21,12 +21,6 @@ deps = dj50: Django>=5.0,<5.1 dj42: Django>=4.2,<4.3 - mysql: mysqlclient==2.2.7 - - postgres: psycopg[binary] - coverage: coverage[toml] - coverage: coverage-enable-subprocess - pytestmin: pytest>=7.0,<7.1 setenv = @@ -39,6 +33,7 @@ setenv = coverage: PYTESTDJANGO_TEST_RUNNER=coverage run -m pytest coverage: COVERAGE_PROCESS_START={toxinidir}/pyproject.toml coverage: COVERAGE_FILE={toxinidir}/.coverage + coverage: PYTESTDJANGO_COVERAGE_SRC={toxinidir}/ passenv = PYTEST_ADDOPTS,TERM,TEST_DB_USER,TEST_DB_PASSWORD,TEST_DB_HOST usedevelop = True From 84b70cabcc2012f1aacf8d95e9eaa5afc0c06312 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Thu, 5 Jun 2025 17:39:03 -0400 Subject: [PATCH 30/34] . --- .github/workflows/main.yml | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a54aff5b..67069e94 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -82,46 +82,29 @@ jobs: python: '3.13' allow_failure: false use_factor: false - - - name: py313-sqlite-xdist-coverage - python: '3.13' + + - name: py39-sqlite-xdist-coverage + python: '3.9' allow_failure: false use_factor: true - # start:Speeding up tests by running them in parallel. - - name: py312-djmain-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 - - - name: py312-dj51-sqlite-xdist-coverage - python: '3.12' - allow_failure: false - use_factor: false - - - name: py312-dj42-sqlite-xdist-coverage - python: '3.12' + - name: py310-sqlite-xdist-coverage + python: '3.10' allow_failure: false - use_factor: false - # end: Speeding up tests by running them in parallel. + use_factor: true - name: py311-sqlite-xdist-coverage python: '3.11' allow_failure: false use_factor: true - - name: py310-sqlite-xdist-coverage - python: '3.10' + - name: py312-sqlite-xdist-coverage + python: '3.12' allow_failure: false use_factor: true - - name: py39-sqlite-xdist-coverage - python: '3.9' + - name: py313-sqlite-xdist-coverage + python: '3.13' allow_failure: false use_factor: true From 903e05df72a728f2b8c35d886d087e7b4d2bc8aa Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Thu, 5 Jun 2025 17:42:43 -0400 Subject: [PATCH 31/34] . --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 29acbf43..3a404215 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ postgres = [ "psycopg[binary]", ] mysql = [ - "mysqlclient==2.1.0", + "mysqlclient==2.2.7", ] xdist = [ "pytest-xdist", From 72dc763b1b9806b33844bcf1afe41115fc990058 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Thu, 5 Jun 2025 17:44:33 -0400 Subject: [PATCH 32/34] . --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 67069e94..dc6f4fcb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,7 +56,7 @@ jobs: uv tool install tox==4.26.0 --with tox-uv - name: Run tox - run: tox + run: tox ${{ matrix.use_factor && '-f' || '-e' }} ${{ matrix.name }} - name: Upload zizmor SARIF report into the GitHub repo code scanning if: contains(matrix.name, 'linting') From 43e182035e8ff4bbd9e109d76281f70564c2bb2b Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Thu, 5 Jun 2025 17:59:22 -0400 Subject: [PATCH 33/34] . --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dc6f4fcb..2b7fa8f2 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.26.0 --with tox-uv - name: Run tox - run: tox ${{ matrix.use_factor && '-f' || '-e' }} ${{ matrix.name }} + 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') From 2c12d04d4ecde72b93d9fd722461861f30beb112 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Thu, 5 Jun 2025 18:09:44 -0400 Subject: [PATCH 34/34] p312 is pretty slow... --- .github/workflows/main.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2b7fa8f2..68ecd2b0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -98,10 +98,22 @@ jobs: allow_failure: false use_factor: true - - name: py312-sqlite-xdist-coverage + # start: Speeding up tests by running them in parallel. + - name: py312-dj42-sqlite-xdist-coverage python: '3.12' allow_failure: false - use_factor: true + 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'