From 19152b444b0690db88aeadab1e3c32df5e5328d1 Mon Sep 17 00:00:00 2001 From: Laurence Jackson Date: Tue, 3 Jan 2023 12:00:58 +0000 Subject: [PATCH 1/2] update numpy and move code coverage badge update to release tests --- .github/workflows/tests_development.yml | 12 ------------ .github/workflows/tests_release.yml | 17 +++++++++++++++++ requirements.txt | 2 +- setup.py | 2 +- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests_development.yml b/.github/workflows/tests_development.yml index 663ffa9f..a8415864 100644 --- a/.github/workflows/tests_development.yml +++ b/.github/workflows/tests_development.yml @@ -58,15 +58,3 @@ jobs: with: pytest-coverage-path: ./pytest-coverage.txt junitxml-path: ./pytest.xml - - - name: Update the coverage Badge - if: github.event.pull_request.base.ref == 'main' # if pull request is merging into main - uses: schneegans/dynamic-badges-action@v1.6.0 - with: - auth: ${{ secrets.PYTEST_COVERAGE_COMMENT }} - gistID: ba102d5f3e592fcd50451c2eff8a803d - filename: hazen_pytest-coverage-comment.json - label: Test coverage - message: ${{ steps.coverageComment.outputs.coverage }} - color: ${{ steps.coverageComment.outputs.color }} - namedLogo: python diff --git a/.github/workflows/tests_release.yml b/.github/workflows/tests_release.yml index 4fda9dac..5b4f235b 100644 --- a/.github/workflows/tests_release.yml +++ b/.github/workflows/tests_release.yml @@ -37,3 +37,20 @@ jobs: set -Eeuxo pipefail pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=hazenlib tests/ | tee pytest-coverage.txt ; echo $? + - name: Pytest coverage comment + id: coverageComment + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-coverage-path: ./pytest-coverage.txt + junitxml-path: ./pytest.xml + + - name: Update the coverage Badge + uses: schneegans/dynamic-badges-action@v1.6.0 + with: + auth: ${{ secrets.PYTEST_COVERAGE_COMMENT }} + gistID: ba102d5f3e592fcd50451c2eff8a803d + filename: hazen_pytest-coverage-comment.json + label: Test coverage + message: ${{ steps.coverageComment.outputs.coverage }} + color: ${{ steps.coverageComment.outputs.color }} + namedLogo: python diff --git a/requirements.txt b/requirements.txt index a3008e0c..60619b6d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # After making changes for core components please update install_requires in setp.py as well pydicom==2.2.2 -numpy==1.21.4 +numpy==1.24.1 matplotlib==3.5.1 pytest==7.1.2 docopt==0.6.2 diff --git a/setup.py b/setup.py index 270aef83..628084a0 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from hazenlib import __version__ install_requires = ['pydicom==2.2.2', - 'numpy==1.21.4', + 'numpy==1.24.1', 'matplotlib==3.5.1', 'docopt==0.6.2', 'opencv-python-headless==4.6.0.66', From 78499d97879f87b0cce3a435ce43190515cada66 Mon Sep 17 00:00:00 2001 From: Laurence Jackson Date: Tue, 3 Jan 2023 12:08:58 +0000 Subject: [PATCH 2/2] Update test_spatial_resolution.py --- tests/test_spatial_resolution.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_spatial_resolution.py b/tests/test_spatial_resolution.py index cd332498..39b6a0f4 100644 --- a/tests/test_spatial_resolution.py +++ b/tests/test_spatial_resolution.py @@ -1,5 +1,6 @@ import unittest import pathlib +import pytest import numpy as np import pydicom @@ -414,8 +415,8 @@ def test_mtf(self): def test_calculate_mtf(self): res = self.hazen_spatial_resolution.calculate_mtf(self.hazen_spatial_resolution.data[0]) - assert res['frequency_encoding_direction'] == self.MTF_FE - assert res['phase_encoding_direction'] == self.MTF_PE + assert res['frequency_encoding_direction'] == pytest.approx(self.MTF_FE) + assert res['phase_encoding_direction'] == pytest.approx(self.MTF_PE) class TestPhilipsResolution(TestSpatialResolution):