From 3c1ad9b6b33a851a0129c0895559ff0a073f8171 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 24 Apr 2024 08:41:43 +0200 Subject: [PATCH 01/35] Added Codecov to CI --- .github/workflows/continuous-integration.yml | 22 +++++++------------- pyproject.toml | 1 + 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 730ec6ce7..5a3612802 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -65,20 +65,6 @@ jobs: run: | python -m pip install --upgrade pip -# - name: Get pip cache dir -# id: pip-cache-dir -# run: | -# echo "::set-output name=dir::$(python -m pip cache dir)" -# -# - name: pip cache -# uses: actions/cache@v2 -# id: pip-cache -# with: -# path: ${{ steps.pip-cache-dir.outputs.dir }} -# key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements.txt') }} -# restore-keys: | -# ${{ matrix.os }}-${{ matrix.python-version }}-pip- - - name: Determine directory of parallel HDF5 library run: | if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then @@ -135,7 +121,7 @@ jobs: run: | export PSYDAC_MESH_DIR=$GITHUB_WORKSPACE/mesh export OMP_NUM_THREADS=2 - python -m pytest -n auto --pyargs psydac -m "not parallel and not petsc" + python -m pytest -n auto --cov psydac.api --pyargs psydac -m "not parallel and not petsc" - name: Run MPI tests with Pytest working-directory: ./pytest @@ -158,6 +144,12 @@ jobs: export OMP_NUM_THREADS=2 python mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs psydac -m "parallel and petsc" + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: kvrigor/psydac + - name: Remove test directory if: ${{ always() }} run: | diff --git a/pyproject.toml b/pyproject.toml index 73d967b17..be53ca003 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,7 @@ dependencies = [ 'matplotlib', 'pytest >= 4.5', 'pytest-xdist >= 1.16', + 'pytest-cov', 'pyyaml >= 5.1', 'packaging', 'pyevtk', From cd78ac3c0f7f724174d5e70e15d95f9c4868e08c Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 2 Oct 2024 17:06:22 +0200 Subject: [PATCH 02/35] coverage: exlude unit tests and pyccelised kernels in the report --- pyproject.toml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index ec2b209f8..05d7a5a23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,3 +69,37 @@ namespaces = false [tool.setuptools.package-data] "*" = ["*.txt"] + +[tool.coverage.run] +branch = true +omit = [ + # Exclude pyccelised kernels + "*/__psydac__/*", + # Unit tests shouldn't be included too + "*/tests/*", + ] + +[tool.coverage.report] +# Regexes for lines to exclude from consideration +exclude_also = [ + # Don't complain about missing debug-only code: + "def __repr__", + "if self\\.debug", + + # Don't complain if tests don't hit defensive assertion code: + "raise AssertionError", + "raise NotImplementedError", + + # Don't complain if non-runnable code isn't run: + "if 0:", + "if __name__ == .__main__.:", + + # Don't complain about abstract methods, they aren't run: + "@(abc\\.)?abstractmethod", + ] + +# Ignore source code that can’t be found, emitting a warning instead of an exception. +ignore_errors = true + +[tool.coverage.html] +directory = "coverage_html_report" From 1bafc854f392e1e6d918d82fe83634a767fce66e Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 2 Oct 2024 17:33:06 +0200 Subject: [PATCH 03/35] CI.yml: added Codacy coverage reporter action --- .github/workflows/continuous-integration.yml | 16 ++++++++-------- pyproject.toml | 5 +++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 3f39277ab..bb51c0ae7 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -157,7 +157,7 @@ jobs: - name: Install project run: | - python -m pip install . + python -m pip install .[test] python -m pip freeze - name: Test Pyccel optimization flags @@ -174,7 +174,13 @@ jobs: run: | export PSYDAC_MESH_DIR=$GITHUB_WORKSPACE/mesh export OMP_NUM_THREADS=2 - python -m pytest -n auto --cov psydac.api --pyargs psydac -m "not parallel and not petsc" + python -m pytest -n auto --cov psydac --cov-report xml:coverage.xml --pyargs psydac -m "not parallel and not petsc" + + - name: Run Codacy coverage reporter + uses: codacy/codacy-coverage-reporter-action@v1.3.0 + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: coverage.xml - name: Run MPI tests with Pytest working-directory: ./pytest @@ -197,12 +203,6 @@ jobs: export OMP_NUM_THREADS=2 python mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs psydac -m "parallel and petsc" - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - slug: kvrigor/psydac - - name: Remove test directory if: ${{ always() }} run: | diff --git a/pyproject.toml b/pyproject.toml index 05d7a5a23..364d2c0ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,11 @@ dependencies = [ 'igakit @ https://github.com/dalcinl/igakit/archive/refs/heads/master.zip' ] +[project.optional-dependencies] +test = [ + "pytest-cov >= 5.0.0", +] + [project.urls] Homepage = "https://github.com/pyccel/psydac" Documentation = "https://pyccel.github.io/psydac" From 1715bfd060bc68db45270d57295686b17f57db57 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 2 Oct 2024 18:16:50 +0200 Subject: [PATCH 04/35] pyproject.toml: deleted redundant pytest-cov --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 364d2c0ed..00a08bd50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,6 @@ dependencies = [ 'matplotlib', 'pytest >= 4.5', 'pytest-xdist >= 1.16', - 'pytest-cov', 'pyyaml >= 5.1', 'packaging', 'pyevtk', From ae33ed03d91992e6c2a888aa73cda705ac575050 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 2 Oct 2024 18:58:48 +0200 Subject: [PATCH 05/35] CI.yml: Codacy reporter should run under pytest folder --- .github/workflows/continuous-integration.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index bb51c0ae7..367f7220e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -177,6 +177,7 @@ jobs: python -m pytest -n auto --cov psydac --cov-report xml:coverage.xml --pyargs psydac -m "not parallel and not petsc" - name: Run Codacy coverage reporter + working-directory: ./pytest uses: codacy/codacy-coverage-reporter-action@v1.3.0 with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} From ab102b920638c93c283c7dbcf689d0f77d859b85 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 2 Oct 2024 19:01:56 +0200 Subject: [PATCH 06/35] CI.yml: Fixed path to coverage.xml --- .github/workflows/continuous-integration.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 367f7220e..c0e95dd6f 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -177,11 +177,10 @@ jobs: python -m pytest -n auto --cov psydac --cov-report xml:coverage.xml --pyargs psydac -m "not parallel and not petsc" - name: Run Codacy coverage reporter - working-directory: ./pytest uses: codacy/codacy-coverage-reporter-action@v1.3.0 with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: coverage.xml + coverage-reports: ./pytest/coverage.xml - name: Run MPI tests with Pytest working-directory: ./pytest From 03f605d846977c752017064910c58a3328e11608 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Fri, 4 Oct 2024 11:54:17 +0200 Subject: [PATCH 07/35] CI.yml: Set coverage config file to pyproject.toml --- .github/workflows/continuous-integration.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c0e95dd6f..308fd766e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -30,6 +30,10 @@ jobs: name: ${{ matrix.os }} / Python ${{ matrix.python-version }} + env: + PSYDAC_MESH_DIR: ${{ github.workspace }}/mesh + OMP_NUM_THREADS: 2 + steps: - uses: actions/checkout@v4 @@ -171,10 +175,11 @@ jobs: - name: Run single-process tests with Pytest working-directory: ./pytest - run: | - export PSYDAC_MESH_DIR=$GITHUB_WORKSPACE/mesh - export OMP_NUM_THREADS=2 - python -m pytest -n auto --cov psydac --cov-report xml:coverage.xml --pyargs psydac -m "not parallel and not petsc" + run: >- + python -m pytest -n auto --cov psydac + --cov-report xml:coverage.xml + --cov-config $GITHUB_WORKSPACE/pyproject.toml + --pyargs psydac -m "not parallel and not petsc" - name: Run Codacy coverage reporter uses: codacy/codacy-coverage-reporter-action@v1.3.0 @@ -185,22 +190,16 @@ jobs: - name: Run MPI tests with Pytest working-directory: ./pytest run: | - export PSYDAC_MESH_DIR=$GITHUB_WORKSPACE/mesh - export OMP_NUM_THREADS=2 python mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs psydac -m "parallel and not petsc" - name: Run single-process PETSc tests with Pytest working-directory: ./pytest run: | - export PSYDAC_MESH_DIR=$GITHUB_WORKSPACE/mesh - export OMP_NUM_THREADS=2 python -m pytest -n auto --pyargs psydac -m "not parallel and petsc" - name: Run MPI PETSc tests with Pytest working-directory: ./pytest run: | - export PSYDAC_MESH_DIR=$GITHUB_WORKSPACE/mesh - export OMP_NUM_THREADS=2 python mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs psydac -m "parallel and petsc" - name: Remove test directory From 07aa1e1707ad0e30bb7ee26fcc5bb0be0b370246 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Fri, 4 Oct 2024 15:16:39 +0200 Subject: [PATCH 08/35] CI.yml: Printed detailed coverage results --- .github/workflows/continuous-integration.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 308fd766e..d228abdd5 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -177,16 +177,22 @@ jobs: working-directory: ./pytest run: >- python -m pytest -n auto --cov psydac + --cov-report term-missing --cov-report xml:coverage.xml --cov-config $GITHUB_WORKSPACE/pyproject.toml --pyargs psydac -m "not parallel and not petsc" - - name: Run Codacy coverage reporter + - name: Upload coverage report to Codacy uses: codacy/codacy-coverage-reporter-action@v1.3.0 with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} coverage-reports: ./pytest/coverage.xml + - name: Print detailed coverage results + working-directory: ./pytest + run: | + coverage report --ignore-errors --show-missing --sort=cover + - name: Run MPI tests with Pytest working-directory: ./pytest run: | From 65c27de7b5c1c8d66fd07d5b1c3f3f22cfa4e649 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Fri, 4 Oct 2024 15:20:02 +0200 Subject: [PATCH 09/35] Excluded examples dir from coverage --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 00a08bd50..192e13636 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,6 +79,8 @@ branch = true omit = [ # Exclude pyccelised kernels "*/__psydac__/*", + # Examples don't need to be covered + "*/examples/*", # Unit tests shouldn't be included too "*/tests/*", ] From 4949d39477b74700cde0368d7750b19bb6bb900d Mon Sep 17 00:00:00 2001 From: kvrigor Date: Fri, 4 Oct 2024 16:22:06 +0200 Subject: [PATCH 10/35] '--cov-report term-missing' is redundant --- .github/workflows/continuous-integration.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index d228abdd5..97bfc7852 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -177,7 +177,6 @@ jobs: working-directory: ./pytest run: >- python -m pytest -n auto --cov psydac - --cov-report term-missing --cov-report xml:coverage.xml --cov-config $GITHUB_WORKSPACE/pyproject.toml --pyargs psydac -m "not parallel and not petsc" From 36620af0f45753f215e453bec9b0ec4a4333b072 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Tue, 8 Oct 2024 07:44:46 +0200 Subject: [PATCH 11/35] Dummy change for checking test runtime --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 192e13636..627a8c452 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,9 +79,11 @@ branch = true omit = [ # Exclude pyccelised kernels "*/__psydac__/*", + # Examples don't need to be covered "*/examples/*", - # Unit tests shouldn't be included too + + # Unit tests shouldn't be included "*/tests/*", ] From 3703d5b28de4b70fa9f0fcdda19f1443b7615896 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Tue, 8 Oct 2024 15:56:17 +0200 Subject: [PATCH 12/35] CI.yml: Generated coverage report on another step --- .github/workflows/continuous-integration.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 97bfc7852..65d77eaed 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -177,10 +177,15 @@ jobs: working-directory: ./pytest run: >- python -m pytest -n auto --cov psydac - --cov-report xml:coverage.xml --cov-config $GITHUB_WORKSPACE/pyproject.toml + --cov-report="" --pyargs psydac -m "not parallel and not petsc" + - name: Generate coverage report for Codacy + working-directory: ./pytest + run: | + coverage xml + - name: Upload coverage report to Codacy uses: codacy/codacy-coverage-reporter-action@v1.3.0 with: From f175d0bc5c92a38451426742fb577689cedf0f50 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 9 Oct 2024 08:56:40 +0200 Subject: [PATCH 13/35] CI.yml: Run tests via coverage instead of pytest-cov --- .github/workflows/continuous-integration.yml | 6 +++--- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 65d77eaed..ccc4c7c14 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -176,9 +176,9 @@ jobs: - name: Run single-process tests with Pytest working-directory: ./pytest run: >- - python -m pytest -n auto --cov psydac - --cov-config $GITHUB_WORKSPACE/pyproject.toml - --cov-report="" + coverage run + --rcfile=pyproject.toml + --module pytest -n auto --pyargs psydac -m "not parallel and not petsc" - name: Generate coverage report for Codacy diff --git a/pyproject.toml b/pyproject.toml index 627a8c452..bb8104029 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ dependencies = [ [project.optional-dependencies] test = [ - "pytest-cov >= 5.0.0", + "coverage", ] [project.urls] From 10d96d43c3ce68fe3c2690480121fc356e05086c Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 9 Oct 2024 09:01:48 +0200 Subject: [PATCH 14/35] CI.yml: Specified full path to pyproject.toml --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index ccc4c7c14..fe589add0 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -177,7 +177,7 @@ jobs: working-directory: ./pytest run: >- coverage run - --rcfile=pyproject.toml + --rcfile=$GITHUB_WORKSPACE/pyproject.toml --module pytest -n auto --pyargs psydac -m "not parallel and not petsc" From fc6e380b594f5704a622bc53937bc04c0878851d Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 9 Oct 2024 10:23:52 +0200 Subject: [PATCH 15/35] CI.yml: Be explicit about the location of the .coverage file --- .github/workflows/continuous-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index fe589add0..68131b423 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -177,14 +177,14 @@ jobs: working-directory: ./pytest run: >- coverage run + --data-file=$GITHUB_WORKSPACE/.coverage --rcfile=$GITHUB_WORKSPACE/pyproject.toml --module pytest -n auto --pyargs psydac -m "not parallel and not petsc" - name: Generate coverage report for Codacy - working-directory: ./pytest run: | - coverage xml + coverage xml --data-file=$GITHUB_WORKSPACE/.coverage - name: Upload coverage report to Codacy uses: codacy/codacy-coverage-reporter-action@v1.3.0 From d2a73f1a480d0a0f63f5c5d81359cfbdab2d9257 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 9 Oct 2024 12:36:44 +0200 Subject: [PATCH 16/35] CI.yml: Ran 'coverage xml' under ./pytest --- .github/workflows/continuous-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 68131b423..fe589add0 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -177,14 +177,14 @@ jobs: working-directory: ./pytest run: >- coverage run - --data-file=$GITHUB_WORKSPACE/.coverage --rcfile=$GITHUB_WORKSPACE/pyproject.toml --module pytest -n auto --pyargs psydac -m "not parallel and not petsc" - name: Generate coverage report for Codacy + working-directory: ./pytest run: | - coverage xml --data-file=$GITHUB_WORKSPACE/.coverage + coverage xml - name: Upload coverage report to Codacy uses: codacy/codacy-coverage-reporter-action@v1.3.0 From e23716e6c22c38df3a44472b5fe0f0368b26913b Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 9 Oct 2024 14:05:42 +0200 Subject: [PATCH 17/35] CI.yml: Run coverage at repo root --- .github/workflows/continuous-integration.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index fe589add0..5af8a9f91 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -174,7 +174,6 @@ jobs: cp mpi_tester.py pytest - name: Run single-process tests with Pytest - working-directory: ./pytest run: >- coverage run --rcfile=$GITHUB_WORKSPACE/pyproject.toml @@ -182,7 +181,6 @@ jobs: --pyargs psydac -m "not parallel and not petsc" - name: Generate coverage report for Codacy - working-directory: ./pytest run: | coverage xml From 6d4aedd716f1197b233c445aecbfdf30e1369322 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Mon, 14 Oct 2024 11:53:18 +0200 Subject: [PATCH 18/35] Fixed missing coverage data by setting coverage subprocess hooks See https://coverage.readthedocs.io/en/7.6.3/subprocess.html#measuring-sub-processes --- .github/workflows/continuous-integration.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 5af8a9f91..e70f5f75a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -173,12 +173,15 @@ jobs: mkdir pytest cp mpi_tester.py pytest + # Coverage data is also collected during single process testing. - name: Run single-process tests with Pytest - run: >- - coverage run - --rcfile=$GITHUB_WORKSPACE/pyproject.toml - --module pytest -n auto - --pyargs psydac -m "not parallel and not petsc" + run: | + export COVERAGE_PROCESS_START="pyproject.toml" + export PYTHONPATH=$(pwd) + echo "import coverage; coverage.process_startup()" > sitecustomize.py + coverage run --module pytest -n auto --pyargs psydac -m "not parallel and not petsc" + rm sitecustomize.py + unset COVERAGE_PROCESS_STARTPYTHONPATH - name: Generate coverage report for Codacy run: | From d995440905dae7d094925ab319020eb8464cefe7 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Mon, 14 Oct 2024 11:59:40 +0200 Subject: [PATCH 19/35] Fixed typo when unsetting coverage env vars --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e70f5f75a..8ecaa5cfb 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -181,7 +181,7 @@ jobs: echo "import coverage; coverage.process_startup()" > sitecustomize.py coverage run --module pytest -n auto --pyargs psydac -m "not parallel and not petsc" rm sitecustomize.py - unset COVERAGE_PROCESS_STARTPYTHONPATH + unset COVERAGE_PROCESS_START PYTHONPATH - name: Generate coverage report for Codacy run: | From 338aa9a491de562f8c40ac81be4eb427bfde043f Mon Sep 17 00:00:00 2001 From: kvrigor Date: Mon, 14 Oct 2024 15:05:51 +0200 Subject: [PATCH 20/35] Made coverage env settings permanent for now --- .github/workflows/continuous-integration.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 8ecaa5cfb..0e268d731 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -33,6 +33,8 @@ jobs: env: PSYDAC_MESH_DIR: ${{ github.workspace }}/mesh OMP_NUM_THREADS: 2 + COVERAGE_PROCESS_START: pyproject.toml + PYTHONPATH: ${{ github.workspace }} steps: - uses: actions/checkout@v4 @@ -168,36 +170,32 @@ jobs: run: | pytest --pyargs psydac -m pyccel --capture=no - - name: Initialize test directory - run: | - mkdir pytest - cp mpi_tester.py pytest - # Coverage data is also collected during single process testing. - name: Run single-process tests with Pytest run: | - export COVERAGE_PROCESS_START="pyproject.toml" - export PYTHONPATH=$(pwd) echo "import coverage; coverage.process_startup()" > sitecustomize.py coverage run --module pytest -n auto --pyargs psydac -m "not parallel and not petsc" - rm sitecustomize.py - unset COVERAGE_PROCESS_START PYTHONPATH - name: Generate coverage report for Codacy run: | coverage xml + pytest --cache-show | grep cachedir # To be removed in the next commit - name: Upload coverage report to Codacy uses: codacy/codacy-coverage-reporter-action@v1.3.0 with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: ./pytest/coverage.xml + coverage-reports: coverage.xml - name: Print detailed coverage results - working-directory: ./pytest run: | coverage report --ignore-errors --show-missing --sort=cover + - name: Initialize MPI test directory + run: | + mkdir pytest + cp mpi_tester.py pytest + - name: Run MPI tests with Pytest working-directory: ./pytest run: | From ee41b764cd4d2685c1bccfdc9cb24120dfb014c0 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Mon, 14 Oct 2024 17:25:53 +0200 Subject: [PATCH 21/35] Try running coverage under ./pytest --- .github/workflows/continuous-integration.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0e268d731..b7501eea5 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -33,8 +33,8 @@ jobs: env: PSYDAC_MESH_DIR: ${{ github.workspace }}/mesh OMP_NUM_THREADS: 2 - COVERAGE_PROCESS_START: pyproject.toml - PYTHONPATH: ${{ github.workspace }} + COVERAGE_PROCESS_START: ${{ github.workspace }}/pyproject.toml + PYTHONPATH: ${{ github.workspace }}/pytest steps: - uses: actions/checkout@v4 @@ -170,13 +170,20 @@ jobs: run: | pytest --pyargs psydac -m pyccel --capture=no + - name: Initialize test directory + run: | + mkdir pytest + cp mpi_tester.py pytest + # Coverage data is also collected during single process testing. - name: Run single-process tests with Pytest + working-directory: ./pytest run: | echo "import coverage; coverage.process_startup()" > sitecustomize.py coverage run --module pytest -n auto --pyargs psydac -m "not parallel and not petsc" - name: Generate coverage report for Codacy + working-directory: ./pytest run: | coverage xml pytest --cache-show | grep cachedir # To be removed in the next commit @@ -188,14 +195,10 @@ jobs: coverage-reports: coverage.xml - name: Print detailed coverage results + working-directory: ./pytest run: | coverage report --ignore-errors --show-missing --sort=cover - - name: Initialize MPI test directory - run: | - mkdir pytest - cp mpi_tester.py pytest - - name: Run MPI tests with Pytest working-directory: ./pytest run: | From 934a705380538369cc1d090aaff78a1bbe40bb3b Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 16 Oct 2024 12:52:50 +0200 Subject: [PATCH 22/35] Revert to pytest-cov Overhead due to coverage data collection is the same for coverage.py and pytest-cov --- .github/workflows/continuous-integration.yml | 10 +++++----- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index b7501eea5..06de22baa 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -33,8 +33,6 @@ jobs: env: PSYDAC_MESH_DIR: ${{ github.workspace }}/mesh OMP_NUM_THREADS: 2 - COVERAGE_PROCESS_START: ${{ github.workspace }}/pyproject.toml - PYTHONPATH: ${{ github.workspace }}/pytest steps: - uses: actions/checkout@v4 @@ -178,9 +176,11 @@ jobs: # Coverage data is also collected during single process testing. - name: Run single-process tests with Pytest working-directory: ./pytest - run: | - echo "import coverage; coverage.process_startup()" > sitecustomize.py - coverage run --module pytest -n auto --pyargs psydac -m "not parallel and not petsc" + run: >- + python -m pytest -n auto --cov psydac + --cov-config $GITHUB_WORKSPACE/pyproject.toml + --cov-report="" + --pyargs psydac -m "not parallel and not petsc" - name: Generate coverage report for Codacy working-directory: ./pytest diff --git a/pyproject.toml b/pyproject.toml index bb8104029..627a8c452 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ dependencies = [ [project.optional-dependencies] test = [ - "coverage", + "pytest-cov >= 5.0.0", ] [project.urls] From b7d61a5c23a0be52fba5da34256515d0c400ec59 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 16 Oct 2024 14:16:39 +0200 Subject: [PATCH 23/35] Fixed path to coverage.xml --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 06de22baa..cbe627ebc 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -192,7 +192,7 @@ jobs: uses: codacy/codacy-coverage-reporter-action@v1.3.0 with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: coverage.xml + coverage-reports: ./pytest/coverage.xml - name: Print detailed coverage results working-directory: ./pytest From 43b35e3f5d3594e4b0db9f05f7942af6551f1a70 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 23 Oct 2024 13:01:03 +0200 Subject: [PATCH 24/35] Cached ./pytest_cache --- .github/workflows/continuous-integration.yml | 20 ++++++++++++-------- psydac/api/equation.py | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index cbe627ebc..ee64a6a63 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -177,17 +177,12 @@ jobs: - name: Run single-process tests with Pytest working-directory: ./pytest run: >- - python -m pytest -n auto --cov psydac + python -m pytest -n auto --failed-first + --cov psydac --cov-config $GITHUB_WORKSPACE/pyproject.toml - --cov-report="" + --cov-report xml --pyargs psydac -m "not parallel and not petsc" - - name: Generate coverage report for Codacy - working-directory: ./pytest - run: | - coverage xml - pytest --cache-show | grep cachedir # To be removed in the next commit - - name: Upload coverage report to Codacy uses: codacy/codacy-coverage-reporter-action@v1.3.0 with: @@ -214,6 +209,15 @@ jobs: run: | python mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs psydac -m "parallel and petsc" + - name: Cache Pytest results + uses: actions/cache@v4 + id: cache-pytest + env: + cache-name: cache-pytest + with: + path: ".pytest_cache" + key: cache-${{ matrix.os }}-${{ matrix.python-version }} + - name: Remove test directory if: ${{ always() }} run: | diff --git a/psydac/api/equation.py b/psydac/api/equation.py index 69ef5a077..2190f90ba 100644 --- a/psydac/api/equation.py +++ b/psydac/api/equation.py @@ -68,7 +68,7 @@ def l2_boundary_projection(equation): test_dict = dict(zip(u, v)) # Compute product of (u, v) using dot product for vector quantities - product = lambda f, g: (f * g if g.atoms(ScalarFunction) else dot(f, g)) + product = lambda f, g: (f * 0.5 * g if g.atoms(ScalarFunction) else dot(f, g)) # Deliberately fail the test # Construct variational formulation that performs L2 projection # of boundary conditions onto the correct space From 051f1ec059c2c233d425a5cde526d92a33c3341c Mon Sep 17 00:00:00 2001 From: kvrigor Date: Wed, 23 Oct 2024 13:14:42 +0200 Subject: [PATCH 25/35] Pytest cache must always be saved regardless of test result --- .github/workflows/continuous-integration.yml | 22 +++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index ee64a6a63..171816742 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -108,7 +108,7 @@ jobs: cache-name: cache-PETSc with: path: "./petsc" - key: cache-${{ matrix.os }}-${{ matrix.python-version }} + key: petsc-${{ matrix.os }}-${{ matrix.python-version }} - if: steps.cache-petsc.outputs.cache-hit != 'true' name: Download a specific release of PETSc @@ -173,6 +173,13 @@ jobs: mkdir pytest cp mpi_tester.py pytest + - name: Restore Pytest cache + id: cache-pytest-restore + uses: actions/cache/restore@v4 + with: + key: pytest-${{ matrix.os }}-${{ matrix.python-version }} + path: "./.pytest_cache" + # Coverage data is also collected during single process testing. - name: Run single-process tests with Pytest working-directory: ./pytest @@ -209,14 +216,13 @@ jobs: run: | python mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs psydac -m "parallel and petsc" - - name: Cache Pytest results - uses: actions/cache@v4 - id: cache-pytest - env: - cache-name: cache-pytest + - name: Always save Pytest cache + id: cache-pytest-save + if: always() && steps.cache-pytest-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 with: - path: ".pytest_cache" - key: cache-${{ matrix.os }}-${{ matrix.python-version }} + key: ${{ steps.cache-pytest-restore.outputs.cache-primary-key }} + path: "./.pytest_cache" - name: Remove test directory if: ${{ always() }} From 02647bae6d4e0754ae080bd16e041528812cdd0a Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 24 Oct 2024 11:51:27 +0200 Subject: [PATCH 26/35] Only run coverage tests on macOS --- .github/workflows/continuous-integration.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 171816742..c84e49413 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -180,8 +180,8 @@ jobs: key: pytest-${{ matrix.os }}-${{ matrix.python-version }} path: "./.pytest_cache" - # Coverage data is also collected during single process testing. - - name: Run single-process tests with Pytest + - name: Run coverage tests on macOS + if: matrix.os == 'macos-latest' working-directory: ./pytest run: >- python -m pytest -n auto --failed-first @@ -190,13 +190,21 @@ jobs: --cov-report xml --pyargs psydac -m "not parallel and not petsc" + - name: Run single-process tests with Pytest on Ubuntu + if: matrix.os == 'ubuntu-latest' + working-directory: ./pytest + run: | + python -m pytest -n auto --failed-first --pyargs psydac -m "not parallel and not petsc" + - name: Upload coverage report to Codacy + if: matrix.os == 'macos-latest' uses: codacy/codacy-coverage-reporter-action@v1.3.0 with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} coverage-reports: ./pytest/coverage.xml - - name: Print detailed coverage results + - name: Print detailed coverage results on macOS + if: matrix.os == 'macos-latest' working-directory: ./pytest run: | coverage report --ignore-errors --show-missing --sort=cover @@ -216,7 +224,7 @@ jobs: run: | python mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs psydac -m "parallel and petsc" - - name: Always save Pytest cache + - name: Save Pytest cache id: cache-pytest-save if: always() && steps.cache-pytest-restore.outputs.cache-hit != 'true' uses: actions/cache/save@v4 From cf024e8415a66dc111b1344359166566fc5ca617 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 24 Oct 2024 11:55:11 +0200 Subject: [PATCH 27/35] Break test_api_3d_scalar --- psydac/api/equation.py | 2 +- psydac/api/tests/test_api_3d_scalar.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/psydac/api/equation.py b/psydac/api/equation.py index 2190f90ba..69ef5a077 100644 --- a/psydac/api/equation.py +++ b/psydac/api/equation.py @@ -68,7 +68,7 @@ def l2_boundary_projection(equation): test_dict = dict(zip(u, v)) # Compute product of (u, v) using dot product for vector quantities - product = lambda f, g: (f * 0.5 * g if g.atoms(ScalarFunction) else dot(f, g)) # Deliberately fail the test + product = lambda f, g: (f * g if g.atoms(ScalarFunction) else dot(f, g)) # Construct variational formulation that performs L2 projection # of boundary conditions onto the correct space diff --git a/psydac/api/tests/test_api_3d_scalar.py b/psydac/api/tests/test_api_3d_scalar.py index 6760b4352..4d24324c9 100644 --- a/psydac/api/tests/test_api_3d_scalar.py +++ b/psydac/api/tests/test_api_3d_scalar.py @@ -144,7 +144,7 @@ def run_poisson_3d_dirneu(solution, f, boundary, ncells, degree, comm=None): # ... # ... compute norms - l2_error = l2norm_h.assemble(u = uh) + l2_error = l2norm_h.assemble(u = uh) + 1 h1_error = h1norm_h.assemble(u = uh) # ... From 70eeff4132b89f5f91e3a85ee78c54a3fb78695d Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 24 Oct 2024 12:30:03 +0200 Subject: [PATCH 28/35] Pytest cache must be updated every run --- .github/workflows/continuous-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c84e49413..92cece9e3 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -226,13 +226,13 @@ jobs: - name: Save Pytest cache id: cache-pytest-save - if: always() && steps.cache-pytest-restore.outputs.cache-hit != 'true' + if: always() uses: actions/cache/save@v4 with: key: ${{ steps.cache-pytest-restore.outputs.cache-primary-key }} path: "./.pytest_cache" - name: Remove test directory - if: ${{ always() }} + if: always() run: | rm -rf pytest From 45d25b1293af0acf8ad7e67ed21ef49e19936746 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 24 Oct 2024 13:28:46 +0200 Subject: [PATCH 29/35] Compute cache key based on hash of ./pytest_cache pytest_cache should be saved whenever its contents changes. Cache saving only triggers if the associated cache key changes; thus the cache key should automatically update based on the contents of pytest_cache, which is uniquely represented by its hash. --- .github/workflows/continuous-integration.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 92cece9e3..be767883e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -177,7 +177,7 @@ jobs: id: cache-pytest-restore uses: actions/cache/restore@v4 with: - key: pytest-${{ matrix.os }}-${{ matrix.python-version }} + key: pytest-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('.pytest_cache/**') }} path: "./.pytest_cache" - name: Run coverage tests on macOS @@ -226,10 +226,10 @@ jobs: - name: Save Pytest cache id: cache-pytest-save - if: always() + if: always() && steps.cache-primes-restore.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: - key: ${{ steps.cache-pytest-restore.outputs.cache-primary-key }} + key: pytest-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('.pytest_cache/**') }} path: "./.pytest_cache" - name: Remove test directory From 65742fd68a9e908556a5baceb667b93b24e683b4 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 24 Oct 2024 14:29:50 +0200 Subject: [PATCH 30/35] Fixed test_api_3d_scalar.py --- psydac/api/tests/test_api_3d_scalar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psydac/api/tests/test_api_3d_scalar.py b/psydac/api/tests/test_api_3d_scalar.py index 4d24324c9..6760b4352 100644 --- a/psydac/api/tests/test_api_3d_scalar.py +++ b/psydac/api/tests/test_api_3d_scalar.py @@ -144,7 +144,7 @@ def run_poisson_3d_dirneu(solution, f, boundary, ncells, degree, comm=None): # ... # ... compute norms - l2_error = l2norm_h.assemble(u = uh) + 1 + l2_error = l2norm_h.assemble(u = uh) h1_error = h1norm_h.assemble(u = uh) # ... From 6d28291996a2831f69920ea300391e52ff0fc9ca Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 24 Oct 2024 15:24:55 +0200 Subject: [PATCH 31/35] Break test_2d_biharmonic.py --- psydac/api/tests/test_2d_biharmonic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psydac/api/tests/test_2d_biharmonic.py b/psydac/api/tests/test_2d_biharmonic.py index 7a15bd7c3..89a215d30 100644 --- a/psydac/api/tests/test_2d_biharmonic.py +++ b/psydac/api/tests/test_2d_biharmonic.py @@ -104,7 +104,7 @@ def run_biharmonic_2d_dir(solution, f, dir_zero_boundary, ncells, degree, backen uh = equation_h.solve() # Compute error norms - l2_error = l2norm_h.assemble(u=uh) + l2_error = l2norm_h.assemble(u=uh) + 1 h1_error = h1norm_h.assemble(u=uh) h2_error = h2norm_h.assemble(u=uh) From 06cb2f8f8d91bfe70931014c07fc4eb4fd9d46f1 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 24 Oct 2024 16:51:30 +0200 Subject: [PATCH 32/35] Break test_2d_laplace.py --- psydac/api/tests/test_2d_laplace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psydac/api/tests/test_2d_laplace.py b/psydac/api/tests/test_2d_laplace.py index 1a7b781e3..b1a679933 100644 --- a/psydac/api/tests/test_2d_laplace.py +++ b/psydac/api/tests/test_2d_laplace.py @@ -106,7 +106,7 @@ def run_laplace_2d(solution, f, dir_zero_boundary, dir_nonzero_boundary, uh = equation_h.solve() # Compute error norms - l2_error = l2norm_h.assemble(u=uh) + l2_error = l2norm_h.assemble(u=uh) + 1 h1_error = h1norm_h.assemble(u=uh) return l2_error, h1_error From 85f869d2fd36adbcdfdcbd8360576218f7947c75 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 24 Oct 2024 17:14:32 +0200 Subject: [PATCH 33/35] Discarded --failed-first idea All single process tests will still be run regardless of test order; thus we don't really reduce test time. --- .github/workflows/continuous-integration.yml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index be767883e..cf1937d19 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -173,18 +173,11 @@ jobs: mkdir pytest cp mpi_tester.py pytest - - name: Restore Pytest cache - id: cache-pytest-restore - uses: actions/cache/restore@v4 - with: - key: pytest-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('.pytest_cache/**') }} - path: "./.pytest_cache" - - name: Run coverage tests on macOS if: matrix.os == 'macos-latest' working-directory: ./pytest run: >- - python -m pytest -n auto --failed-first + python -m pytest -n auto --cov psydac --cov-config $GITHUB_WORKSPACE/pyproject.toml --cov-report xml @@ -194,7 +187,7 @@ jobs: if: matrix.os == 'ubuntu-latest' working-directory: ./pytest run: | - python -m pytest -n auto --failed-first --pyargs psydac -m "not parallel and not petsc" + python -m pytest -n auto --pyargs psydac -m "not parallel and not petsc" - name: Upload coverage report to Codacy if: matrix.os == 'macos-latest' @@ -224,14 +217,6 @@ jobs: run: | python mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs psydac -m "parallel and petsc" - - name: Save Pytest cache - id: cache-pytest-save - if: always() && steps.cache-primes-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - key: pytest-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('.pytest_cache/**') }} - path: "./.pytest_cache" - - name: Remove test directory if: always() run: | From 5567cf75123edc7737d8c75487268f552217133e Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 24 Oct 2024 17:21:37 +0200 Subject: [PATCH 34/35] Fixed deliberately broken tests --- psydac/api/tests/test_2d_biharmonic.py | 2 +- psydac/api/tests/test_2d_laplace.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/psydac/api/tests/test_2d_biharmonic.py b/psydac/api/tests/test_2d_biharmonic.py index 89a215d30..7a15bd7c3 100644 --- a/psydac/api/tests/test_2d_biharmonic.py +++ b/psydac/api/tests/test_2d_biharmonic.py @@ -104,7 +104,7 @@ def run_biharmonic_2d_dir(solution, f, dir_zero_boundary, ncells, degree, backen uh = equation_h.solve() # Compute error norms - l2_error = l2norm_h.assemble(u=uh) + 1 + l2_error = l2norm_h.assemble(u=uh) h1_error = h1norm_h.assemble(u=uh) h2_error = h2norm_h.assemble(u=uh) diff --git a/psydac/api/tests/test_2d_laplace.py b/psydac/api/tests/test_2d_laplace.py index b1a679933..1a7b781e3 100644 --- a/psydac/api/tests/test_2d_laplace.py +++ b/psydac/api/tests/test_2d_laplace.py @@ -106,7 +106,7 @@ def run_laplace_2d(solution, f, dir_zero_boundary, dir_nonzero_boundary, uh = equation_h.solve() # Compute error norms - l2_error = l2norm_h.assemble(u=uh) + 1 + l2_error = l2norm_h.assemble(u=uh) h1_error = h1norm_h.assemble(u=uh) return l2_error, h1_error From a443720ba960043cba811313f98c2bae2f734c2d Mon Sep 17 00:00:00 2001 From: kvrigor Date: Mon, 28 Oct 2024 13:18:17 +0100 Subject: [PATCH 35/35] Declared all pytest packages as optional dependencies; in pyproject.toml, changed if 0 -: if False --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 627a8c452..9441e6be5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,8 +26,6 @@ dependencies = [ 'scipy >= 1.12', 'sympy >= 1.5', 'matplotlib', - 'pytest >= 4.5', - 'pytest-xdist >= 1.16', 'pyyaml >= 5.1', 'packaging', 'pyevtk', @@ -56,6 +54,8 @@ dependencies = [ [project.optional-dependencies] test = [ "pytest-cov >= 5.0.0", + 'pytest >= 4.5', + 'pytest-xdist >= 1.16', ] [project.urls] @@ -99,7 +99,7 @@ exclude_also = [ "raise NotImplementedError", # Don't complain if non-runnable code isn't run: - "if 0:", + "if False:", "if __name__ == .__main__.:", # Don't complain about abstract methods, they aren't run: