From 1b58c28b2467b4d32a49dd7fc35d5f2d97972d41 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Thu, 24 Oct 2024 16:13:42 +0200 Subject: [PATCH 1/8] add test coverage for py3.12 --- .github/workflows/build.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e61915a95..028eba0be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,17 @@ jobs: if: matrix.test-format - run: pyright --version - run: pyright -p pyproject.toml --pythonversion ${{ matrix.python-version }} - - run: pytest + - if: matrix.python-version != '3.12' + run: pytest + - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' + run: pytest --cov-report xml:coverage.xml + - if: matrix.python-version != '3.12' || github.event_name != 'pull_request' + uses: orgoro/coverage@v3.2 + with: + coverageFile: coverage.xml + token: ${{ secrets.GITHUB_TOKEN }} + + deploy: runs-on: ubuntu-latest From 73492ceb9ef6b0569a31aa1cab4764b6b73215bc Mon Sep 17 00:00:00 2001 From: fynnbe Date: Thu, 24 Oct 2024 16:53:32 +0200 Subject: [PATCH 2/8] try to fix coverage CI steps --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 028eba0be..e2887b62c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,11 +43,13 @@ jobs: if: matrix.test-format - run: pyright --version - run: pyright -p pyproject.toml --pythonversion ${{ matrix.python-version }} - - if: matrix.python-version != '3.12' + - if: matrix.python-version != '3.12' || github.event_name != 'pull_request' run: pytest + - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' + run: pip install pytest-cov - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' run: pytest --cov-report xml:coverage.xml - - if: matrix.python-version != '3.12' || github.event_name != 'pull_request' + - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' uses: orgoro/coverage@v3.2 with: coverageFile: coverage.xml From 5db4708c339134bd8e6d17a1271ef9a6ea3c5063 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Fri, 25 Oct 2024 15:36:00 +0200 Subject: [PATCH 3/8] check if coverage.xml was created --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e2887b62c..053bc4e24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,6 +49,7 @@ jobs: run: pip install pytest-cov - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' run: pytest --cov-report xml:coverage.xml + - run: ls coverage.xml - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' uses: orgoro/coverage@v3.2 with: From 4afb0fbba2bdb53add96bcb182428a1c19167df2 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Mon, 28 Oct 2024 11:53:42 +0100 Subject: [PATCH 4/8] update test --- tests/test_generic/test_v0_2.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_generic/test_v0_2.py b/tests/test_generic/test_v0_2.py index 3bdb10ac2..953137bad 100644 --- a/tests/test_generic/test_v0_2.py +++ b/tests/test_generic/test_v0_2.py @@ -167,7 +167,12 @@ ], ) def test_node(node_class: Type[Node], kwargs: Dict[str, Any], is_valid: bool): - check_node(node_class, kwargs, is_invalid=not is_valid) + check_node( + node_class, + kwargs, + is_invalid=not is_valid, + context=ValidationContext(perform_io_checks=True), + ) def test_deprecated_license_in_generic(): From 02396123f5127556707bb82bae307b4bcc969858 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Mon, 28 Oct 2024 12:53:29 +0100 Subject: [PATCH 5/8] add if statement for ls coverage.xml --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 053bc4e24..bdd0d46bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,7 +49,8 @@ jobs: run: pip install pytest-cov - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' run: pytest --cov-report xml:coverage.xml - - run: ls coverage.xml + - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' + run: ls coverage.xml - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' uses: orgoro/coverage@v3.2 with: From 4aa5595b47f525d54ba0bfeefbb1227fc945a7ad Mon Sep 17 00:00:00 2001 From: fynnbe Date: Mon, 28 Oct 2024 13:12:33 +0100 Subject: [PATCH 6/8] include cov-report option in pyproject.toml instead --- .github/workflows/build.yml | 10 ++-------- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bdd0d46bd..0c553eab4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,14 +43,8 @@ jobs: if: matrix.test-format - run: pyright --version - run: pyright -p pyproject.toml --pythonversion ${{ matrix.python-version }} - - if: matrix.python-version != '3.12' || github.event_name != 'pull_request' - run: pytest - - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' - run: pip install pytest-cov - - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' - run: pytest --cov-report xml:coverage.xml - - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' - run: ls coverage.xml + - run: pytest + - run: ls coverage.xml - if: matrix.python-version == '3.12' && github.event_name == 'pull_request' uses: orgoro/coverage@v3.2 with: diff --git a/pyproject.toml b/pyproject.toml index 23220a3c3..1d9f814a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ typeCheckingMode = "strict" useLibraryCodeForTypes = true [tool.pytest.ini_options] -addopts = "-n auto --capture=no --failed-first" # --doctest-modules +addopts = "-n auto --capture=no --failed-first --cov-report xml:coverage.xml --cov bioimageio tests/" # --doctest-modules testpaths = ["bioimageio/spec", "tests", "scripts"] [tool.ruff] From 7ecb2a9d7635fb362eb86121cc32e8db3face675 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Mon, 28 Oct 2024 13:32:34 +0100 Subject: [PATCH 7/8] update pytest ini options --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1d9f814a5..74eb9f017 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ typeCheckingMode = "strict" useLibraryCodeForTypes = true [tool.pytest.ini_options] -addopts = "-n auto --capture=no --failed-first --cov-report xml:coverage.xml --cov bioimageio tests/" # --doctest-modules +addopts = "--cov=bioimageio --cov-report=xml -n auto --capture=no --failed-first" # --doctest-modules testpaths = ["bioimageio/spec", "tests", "scripts"] [tool.ruff] From 5236323dd87bf7da1ee9548c70769f703ef0dc1e Mon Sep 17 00:00:00 2001 From: fynnbe Date: Mon, 28 Oct 2024 13:40:27 +0100 Subject: [PATCH 8/8] add pytest-cov dependency pytest-xdist does not support --cov argument --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index a677f3e4d..fea1804bd 100644 --- a/setup.py +++ b/setup.py @@ -62,6 +62,7 @@ "pre-commit", "psutil", # parallel pytest with '-n auto' "pyright==1.1.378", + "pytest-cov", "pytest-xdist", # parallel pytest "pytest", "python-devtools",