From 9cad0f30a1cc183cfb63627498572417bab7afce Mon Sep 17 00:00:00 2001 From: Johanna England Date: Fri, 15 Nov 2024 15:29:58 +0100 Subject: [PATCH 1/7] Escape hashtags in tox.ini https://tox.wiki/en/latest/upgrading.html#changed-ini-rules --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 276d0d16b3..07e3605982 100644 --- a/tox.ini +++ b/tox.ini @@ -79,10 +79,10 @@ commands = integration: python -m nav.django.manage check {integration,functional}: nav config install {envdir}/etc {integration,functional}: mkdir -p {envdir}/uploads - {integration,functional}: sed -i 's,^#\?UPLOAD_DIR.*.,UPLOAD_DIR={envdir}/uploads,' {envdir}/etc/nav.conf - integration: sed -i 's/^#DJANGO_DEBUG.*/DJANGO_DEBUG=True/' {envdir}/etc/nav.conf + {integration,functional}: sed -i 's,^\#\?UPLOAD_DIR.*.,UPLOAD_DIR={envdir}/uploads,' {envdir}/etc/nav.conf + integration: sed -i 's/^\#DJANGO_DEBUG.*/DJANGO_DEBUG=True/' {envdir}/etc/nav.conf integration: sed -i 's/^NAV_USER.*/NAV_USER={env:USER}/' {envdir}/etc/nav.conf - integration: sed -i 's,^#base.*,base=http://localhost:9000,' {envdir}/etc/graphite.conf + integration: sed -i 's,^\#base.*,base=http://localhost:9000,' {envdir}/etc/graphite.conf integration: django-admin collectstatic --noinput integration: pytest -o junit_suite_name="{envname} integration tests" --cov-config {toxinidir}/tests/.coveragerc --cov={toxinidir}/python --cov-report=xml:reports/{envname}/coverage.xml --html reports/{envname}/integration-report.html --junitxml=reports/{envname}/integration-results.xml --verbose --showlocals {posargs:tests/integration} From 330d06e3466f84bee427511667878e91b2eb1f52 Mon Sep 17 00:00:00 2001 From: Johanna England Date: Tue, 19 Nov 2024 15:51:44 +0100 Subject: [PATCH 2/7] Change docs to not mention Python 3.8 anymore --- doc/hacking/hacking.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/hacking/hacking.rst b/doc/hacking/hacking.rst index 69798f2c91..09db2955da 100644 --- a/doc/hacking/hacking.rst +++ b/doc/hacking/hacking.rst @@ -459,7 +459,7 @@ like thus: ... $ make shell ... - $ tox -e unit-py38-django32 + $ tox -e unit-py39-django32 ... From b801cbf85b9e22a4867b025054e55d4156e47b75 Mon Sep 17 00:00:00 2001 From: Johanna England Date: Thu, 21 Nov 2024 09:46:41 +0100 Subject: [PATCH 3/7] Set package to editable instead of usedevelop to true This was recommended in the tox docs: https://tox.wiki/en/latest/config.html#package --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 07e3605982..45b089c786 100644 --- a/tox.ini +++ b/tox.ini @@ -66,7 +66,7 @@ allowlist_externals = chmod make -usedevelop = true +package = editable commands_pre = mkdir -p {toxinidir}/reports/coverage chmod 777 {toxinidir}/reports/coverage From b4de4639dbb28011fdfd61f5fba8a17099f7267a Mon Sep 17 00:00:00 2001 From: Johanna England Date: Thu, 21 Nov 2024 09:48:45 +0100 Subject: [PATCH 4/7] Set skipdist to false In the case of being in development mode and having set skipdist to true tox4 would not install NAV in the test environment --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index 45b089c786..2f716a2e40 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,6 @@ envlist = {unit,integration,functional}-py{39,310}-django{32} javascript docs -skipsdist = True basepython = python3.9 [pytest] From 28367a21e331f52f57483133f0224ec931f76e38 Mon Sep 17 00:00:00 2001 From: Johanna England Date: Tue, 19 Nov 2024 15:53:41 +0100 Subject: [PATCH 5/7] Use tox run subcommand to run tests --- doc/hacking/hacking.rst | 2 +- tests/docker/test.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/hacking/hacking.rst b/doc/hacking/hacking.rst index 09db2955da..d9eb847f03 100644 --- a/doc/hacking/hacking.rst +++ b/doc/hacking/hacking.rst @@ -459,7 +459,7 @@ like thus: ... $ make shell ... - $ tox -e unit-py39-django32 + $ tox run -e unit-py39-django32 ... diff --git a/tests/docker/test.sh b/tests/docker/test.sh index 0fdcab38d1..913cfe61cc 100755 --- a/tests/docker/test.sh +++ b/tests/docker/test.sh @@ -2,10 +2,10 @@ # MAIN EXECUTION POINT cd "$WORKSPACE" -tox +tox run # Code analysis steps -tox -e pylint +tox run -e pylint /count-lines-of-code.sh echo "test.sh done" From e4112ff253ff7095dd42511240ec9f93dde284a6 Mon Sep 17 00:00:00 2001 From: Johanna England Date: Tue, 19 Nov 2024 15:53:59 +0100 Subject: [PATCH 6/7] Use tox 4 to run test suite --- .github/workflows/build-and-test.yml | 2 +- tests/docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 9cad63cb3e..93057c2dee 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -56,7 +56,7 @@ jobs: - name: "Install test runner dependencies" run: | set -xe - python3 -m pip install --upgrade 'pip==23.1.0' setuptools wheel 'tox<4' tox-gh-actions coverage virtualenv + python3 -m pip install --upgrade 'pip==23.1.0' setuptools wheel tox tox-gh-actions coverage virtualenv sudo apt-get install -y nbtscan # virtualenv seems to currently be embedding a broken version of diff --git a/tests/docker/Dockerfile b/tests/docker/Dockerfile index 58611ecff7..cc01b0bbe8 100644 --- a/tests/docker/Dockerfile +++ b/tests/docker/Dockerfile @@ -68,7 +68,7 @@ RUN cd /tmp && \ mv chromedriver-linux64/chromedriver /usr/local/bin/ # Install our primary test runner -RUN python3.9 -m pip install 'tox<4' virtualenv +RUN python3.9 -m pip install tox virtualenv # Add a build user ENV USER build From 7bec719e4d4adf8fcdfbd1c25088eaef6b0be0be Mon Sep 17 00:00:00 2001 From: Johanna England Date: Wed, 20 Nov 2024 12:58:39 +0100 Subject: [PATCH 7/7] Add news fragment --- changelog.d/2973.changed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2973.changed.md diff --git a/changelog.d/2973.changed.md b/changelog.d/2973.changed.md new file mode 100644 index 0000000000..71884b910f --- /dev/null +++ b/changelog.d/2973.changed.md @@ -0,0 +1 @@ +Run tests using tox version 4