From 5f689df30f1962163ee4bb197526d861aba17e98 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Mon, 1 Sep 2025 20:18:14 +0100 Subject: [PATCH 1/3] minor: use pytest.skip instead of return in test_torchoperator --- pytests/test_torchoperator.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pytests/test_torchoperator.py b/pytests/test_torchoperator.py index edada492f..899d6a98c 100644 --- a/pytests/test_torchoperator.py +++ b/pytests/test_torchoperator.py @@ -32,8 +32,8 @@ def test_TorchOperator(par): """ # temporarily, skip tests on mac as torch seems not to recognized # numpy when v2 is installed - if platform.system() == "Darwin": - return + if platform.system() == "darwin": + pytest.skip("torch not recognized on macOS with numpy v2") device = "cpu" if backend == "numpy" else "cuda" Dop = MatrixMult(np.random.normal(0.0, 1.0, (par["ny"], par["nx"]))) @@ -62,8 +62,8 @@ def test_TorchOperator_batch(par): """Apply forward for input with multiple samples (= batch) and flattened arrays""" # temporarily, skip tests on mac as torch seems not to recognized # numpy when v2 is installed - if platform.system() == "Darwin": - return + if platform.system() == "darwin": + pytest.skip("torch not recognized on macOS with numpy v2") device = "cpu" if backend == "numpy" else "cuda" Dop = MatrixMult(np.random.normal(0.0, 1.0, (par["ny"], par["nx"]))) @@ -84,8 +84,8 @@ def test_TorchOperator_batch_nd(par): """Apply forward for input with multiple samples (= batch) and nd-arrays""" # temporarily, skip tests on mac as torch seems not to recognized # numpy when v2 is installed - if platform.system() == "Darwin": - return + if platform.system() == "darwin": + pytest.skip("torch not recognized on macOS with numpy v2") device = "cpu" if backend == "numpy" else "cuda" Dop = MatrixMult(np.random.normal(0.0, 1.0, (par["ny"], par["nx"])), otherdims=(2,)) From 17c9f351dcc47ec9cb6a1256d025ccd0644f3bc4 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Mon, 1 Sep 2025 20:41:14 +0100 Subject: [PATCH 2/3] minor: switch darwin to Darwin --- pytests/test_torchoperator.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pytests/test_torchoperator.py b/pytests/test_torchoperator.py index 899d6a98c..220a5148a 100644 --- a/pytests/test_torchoperator.py +++ b/pytests/test_torchoperator.py @@ -32,7 +32,8 @@ def test_TorchOperator(par): """ # temporarily, skip tests on mac as torch seems not to recognized # numpy when v2 is installed - if platform.system() == "darwin": + if platform.system() == "Darwin": + print("here") pytest.skip("torch not recognized on macOS with numpy v2") device = "cpu" if backend == "numpy" else "cuda" @@ -62,7 +63,7 @@ def test_TorchOperator_batch(par): """Apply forward for input with multiple samples (= batch) and flattened arrays""" # temporarily, skip tests on mac as torch seems not to recognized # numpy when v2 is installed - if platform.system() == "darwin": + if platform.system() == "Darwin": pytest.skip("torch not recognized on macOS with numpy v2") device = "cpu" if backend == "numpy" else "cuda" @@ -84,7 +85,7 @@ def test_TorchOperator_batch_nd(par): """Apply forward for input with multiple samples (= batch) and nd-arrays""" # temporarily, skip tests on mac as torch seems not to recognized # numpy when v2 is installed - if platform.system() == "darwin": + if platform.system() == "Darwin": pytest.skip("torch not recognized on macOS with numpy v2") device = "cpu" if backend == "numpy" else "cuda" From d104cd4fff637964924244cda19bde2109cf578e Mon Sep 17 00:00:00 2001 From: mrava87 Date: Mon, 1 Sep 2025 21:05:07 +0100 Subject: [PATCH 3/3] minor: removed print and unused import --- pytests/test_torchoperator.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pytests/test_torchoperator.py b/pytests/test_torchoperator.py index 220a5148a..85d9c4be0 100644 --- a/pytests/test_torchoperator.py +++ b/pytests/test_torchoperator.py @@ -11,7 +11,6 @@ from numpy.testing import assert_array_equal backend = "numpy" -import numpy as npp import pytest import torch @@ -33,7 +32,6 @@ def test_TorchOperator(par): # temporarily, skip tests on mac as torch seems not to recognized # numpy when v2 is installed if platform.system() == "Darwin": - print("here") pytest.skip("torch not recognized on macOS with numpy v2") device = "cpu" if backend == "numpy" else "cuda"