From 8cd8391747e5096b47d8a6cd5ab2c6ad6d461e63 Mon Sep 17 00:00:00 2001 From: Alessandro Felder Date: Mon, 29 Apr 2024 16:38:25 +0100 Subject: [PATCH] run CI on both types of Mac (#174) * run CI on both types of Mac * install hdf on ARM * == > np.isclose needed because different Mac architectures give slightly different numerical values. * distinguish datatypes in test assertions * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/test_and_deploy.yml | 7 ++++++- .../test_unit/test_regions/test_region_analysis.py | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 6a8a7c0..872fde1 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -32,7 +32,9 @@ jobs: include: - os: ubuntu-latest python-version: "3.11" - - os: macos-latest + - os: macos-13 # Intel Mac + python-version: "3.10" + - os: macos-latest # ARM Mac python-version: "3.10" - os: windows-latest python-version: "3.9" @@ -43,6 +45,9 @@ jobs: with: path: ~/.brainglobe key: bg-atlases + - name: install HDF5 libs on ARM Mac + if: matrix.os == 'macos-latest' + run: brew install hdf5 # Setup pyqt libraries - uses: tlambert03/setup-qt-libs@v1 # Helps set up VTK with a headless display diff --git a/tests/tests/test_unit/test_regions/test_region_analysis.py b/tests/tests/test_unit/test_regions/test_region_analysis.py index 93dd4b5..c9f31f8 100644 --- a/tests/tests/test_unit/test_regions/test_region_analysis.py +++ b/tests/tests/test_unit/test_regions/test_region_analysis.py @@ -99,7 +99,10 @@ def test_summarise_brain_regions_all_not_empty( df = pd.read_csv(filename) assert df.shape == (3, 11) for key, value in previous_world_space_values.items(): - assert df[key].iloc[0] == value + if isinstance(value, (int, float)): + assert np.isclose(df[key].iloc[0], value) + else: + assert df[key].iloc[0] == value def test_summarise_brain_regions_some_empty( @@ -124,7 +127,10 @@ def test_summarise_brain_regions_some_empty( df = pd.read_csv(filename) assert df.shape == (1, 11) for key, value in previous_world_space_values.items(): - assert df[key].iloc[0] == value + if isinstance(value, (int, float)): + assert np.isclose(df[key].iloc[0], value) + else: + assert df[key].iloc[0] == value def test_summarise_brain_regions_all_empty(