From 335f41b8f9fbebc1efa07bcf862d48d6f3ad45fb Mon Sep 17 00:00:00 2001 From: paugier Date: Sun, 18 Feb 2024 22:02:19 +0100 Subject: [PATCH] Skip tests on Windows and MacOS --- .gitlab-ci.yml | 2 +- src/fluidimage/test_run_from_xml.py | 8 ++++---- src/fluidimage/topologies/test_bos.py | 8 ++++---- src/fluidimage/topologies/test_example.py | 9 ++++----- src/fluidimage/topologies/test_image2image.py | 12 ++++++------ src/fluidimage/topologies/test_optical_flow.py | 4 ---- src/fluidimage/topologies/test_piv.py | 8 ++++---- 7 files changed, 23 insertions(+), 28 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a5769ed8..8b5412ce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ workflow: pixi-test: stage: pixi - image: registry.heptapod.net:443/fluiddyn/fluidsim/ci/default:pixi + image: registry.heptapod.net:443/fluiddyn/fluiddyn/ci/default:pixi script: - pixi info - pixi run install-editable diff --git a/src/fluidimage/test_run_from_xml.py b/src/fluidimage/test_run_from_xml.py index 7ddaaa8d..5d9fdbdc 100644 --- a/src/fluidimage/test_run_from_xml.py +++ b/src/fluidimage/test_run_from_xml.py @@ -2,13 +2,13 @@ import sys import unittest -from fluiddyn.io import stdout_redirected - from fluidimage import get_path_image_samples from fluidimage.run_from_xml import main path_image_samples = get_path_image_samples() +on_linux = sys.platform == "linux" + class TestRunFromXML(unittest.TestCase): @classmethod @@ -20,10 +20,10 @@ def setUpClass(cls): def tearDownClass(cls): os.chdir(cls.current_dir) + @unittest.skipIf(not on_linux, "Only supported on Linux") def test_main(self): path = path_image_samples / "Karman/Images.civ/0_XML/Karman_1-4.xml" command = f"run {str(path)} --mode recompute" sys.argv = command.split() - with stdout_redirected(): - main() + main() diff --git a/src/fluidimage/topologies/test_bos.py b/src/fluidimage/topologies/test_bos.py index 4da60b7a..2ad0dcf9 100644 --- a/src/fluidimage/topologies/test_bos.py +++ b/src/fluidimage/topologies/test_bos.py @@ -1,3 +1,4 @@ +import sys import unittest from pathlib import Path from shutil import rmtree @@ -5,6 +6,8 @@ from fluidimage import get_path_image_samples from fluidimage.topologies.bos import TopologyBOS +on_linux = sys.platform == "linux" + class TestBOSNew(unittest.TestCase): @classmethod @@ -19,6 +22,7 @@ def tearDownClass(cls): if path_out.exists(): rmtree(path_out, ignore_errors=True) + @unittest.skipIf(not on_linux, "Only supported on Linux") def test_bos_new_multiproc(self): params = TopologyBOS.create_default_params() @@ -51,7 +55,3 @@ def test_bos_new_multiproc(self): params.saving.how = "complete" topology = TopologyBOS(params, logging_level="info") topology.compute() - - -if __name__ == "__main__": - unittest.main() diff --git a/src/fluidimage/topologies/test_example.py b/src/fluidimage/topologies/test_example.py index 76d858db..e677ab39 100644 --- a/src/fluidimage/topologies/test_example.py +++ b/src/fluidimage/topologies/test_example.py @@ -1,3 +1,4 @@ +import sys import unittest from functools import partialmethod from shutil import rmtree @@ -12,12 +13,14 @@ "exec_sequential", "exec_async_sequential", "exec_async", - "multi_exec_async", "exec_async_multi", "exec_async_servers", "exec_async_servers_threading", ] +if sys.platform == "linux": + executors.append("multi_exec_async") + def _test(self, executor=None): params = TopologyExample.create_default_params() @@ -51,7 +54,3 @@ def tearDown(self): "test_" + str(executor), partialmethod(_test, executor=executor), ) - - -if __name__ == "__main__": - unittest.main() diff --git a/src/fluidimage/topologies/test_image2image.py b/src/fluidimage/topologies/test_image2image.py index c1d3e375..64d02617 100644 --- a/src/fluidimage/topologies/test_image2image.py +++ b/src/fluidimage/topologies/test_image2image.py @@ -1,3 +1,4 @@ +import sys import unittest from pathlib import Path from shutil import rmtree @@ -5,8 +6,11 @@ from fluidimage import get_path_image_samples from fluidimage.topologies.image2image import TopologyImage2Image +on_linux = sys.platform == "linux" -class TestPivNew(unittest.TestCase): + +@unittest.skipIf(not on_linux, "Only supported on Linux") +class TestImage2Image(unittest.TestCase): @classmethod def setUpClass(cls): cls.path_src = get_path_image_samples() / "Karman/Images" @@ -18,7 +22,7 @@ def tearDownClass(cls): if path_out.exists(): rmtree(path_out, ignore_errors=True) - def test_piv_new(self): + def test_im2im(self): params = TopologyImage2Image.create_default_params() params.images.path = str(self.path_src) @@ -36,7 +40,3 @@ def test_piv_new(self): topology.compute() topology.make_code_graphviz(topology.path_dir_result / "topo.dot") - - -if __name__ == "__main__": - unittest.main() diff --git a/src/fluidimage/topologies/test_optical_flow.py b/src/fluidimage/topologies/test_optical_flow.py index 3fbdeaee..0c9a9947 100644 --- a/src/fluidimage/topologies/test_optical_flow.py +++ b/src/fluidimage/topologies/test_optical_flow.py @@ -41,7 +41,3 @@ def test_optical_flow(self): topology.make_code_graphviz(topology.path_dir_result / "topo.dot") topology.compute("exec_sequential") - - -if __name__ == "__main__": - unittest.main() diff --git a/src/fluidimage/topologies/test_piv.py b/src/fluidimage/topologies/test_piv.py index f0faaaed..a383e615 100644 --- a/src/fluidimage/topologies/test_piv.py +++ b/src/fluidimage/topologies/test_piv.py @@ -1,3 +1,4 @@ +import sys import unittest from pathlib import Path from shutil import rmtree @@ -8,7 +9,10 @@ path_image_samples = get_path_image_samples() +on_linux = sys.platform == "linux" + +@unittest.skipIf(not on_linux, "Only supported on Linux") class TestPivNew(unittest.TestCase): @classmethod def setUpClass(cls): @@ -80,7 +84,3 @@ def test_piv_new_multiproc(self): topology.compute("exec_sequential") assert len(topology.results) == 1 - - -if __name__ == "__main__": - unittest.main()