From 9a7dc929be23742fa71de8bb84c52820db71ce35 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Sun, 26 Apr 2026 15:37:25 -0700 Subject: [PATCH 1/2] modify skip condition for tests not involving MPI to include compile-time and runtime check --- python/tests/test_dump_load.py | 20 ++++++++++++++++---- python/tests/test_simulation.py | 7 +++++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/python/tests/test_dump_load.py b/python/tests/test_dump_load.py index cf429fc70..78c960316 100644 --- a/python/tests/test_dump_load.py +++ b/python/tests/test_dump_load.py @@ -119,7 +119,10 @@ def get_field_point(sim): def test_load_dump_structure_2d(self): self._load_dump_structure_2d() - @unittest.skipIf(not mp.with_mpi(), "MPI specific test") + @unittest.skipIf( + not mp.with_mpi() or mp.count_processors < 2, + "MPI specific test (requires mpirun with more than 1 process)", + ) def test_load_dump_structure_sharded_2d(self): self._load_dump_structure_2d(single_parallel_file=False) @@ -226,7 +229,10 @@ def get_field_point(sim): def test_load_dump_structure_3d(self): self._load_dump_structure_3d() - @unittest.skipIf(not mp.with_mpi(), "MPI specific test") + @unittest.skipIf( + not mp.with_mpi() or mp.count_processors < 2, + "MPI specific test (requires mpirun with more than 1 process)", + ) def test_load_dump_structure_sharded_3d(self): self._load_dump_structure_3d(single_parallel_file=False) @@ -348,7 +354,10 @@ def get_field_point(sim): def test_load_dump_fields_2d(self): self._load_dump_fields_2d() - @unittest.skipIf(not mp.with_mpi(), "MPI specific test") + @unittest.skipIf( + not mp.with_mpi() or mp.count_processors < 2, + "MPI specific test (requires mpirun with more than 1 process)", + ) def test_load_dump_fields_sharded_2d(self): self._load_dump_fields_2d(single_parallel_file=False) @@ -468,7 +477,10 @@ def get_field_point(sim): def test_load_dump_fields_3d(self): self._load_dump_fields_3d() - @unittest.skipIf(not mp.with_mpi(), "MPI specific test") + @unittest.skipIf( + not mp.with_mpi() or mp.count_processors < 2, + "MPI specific test (requires mpirun with more than 1 process)", + ) def test_load_dump_fields_sharded_3d(self): self._load_dump_fields_3d(single_parallel_file=False) diff --git a/python/tests/test_simulation.py b/python/tests/test_simulation.py index 271dc1617..843ff89c2 100644 --- a/python/tests/test_simulation.py +++ b/python/tests/test_simulation.py @@ -219,9 +219,12 @@ def init_simple_simulation(self, **kwargs): **kwargs, ) - @unittest.skipIf(not mp.with_mpi(), "MPI specific test") + @unittest.skipIf( + not mp.with_mpi() or mp.count_processors < 2, + "MPI specific test (requires mpirun with more than 1 process)", + ) def test_mpi(self): - self.assertGreater(mp.comm.Get_size(), 1) + self.assertGreater(mp.count_processors(), 1) def test_use_output_directory_default(self): sim = self.init_simple_simulation() From 6500e7024516b9e5f9f4d0a7c1c2472bb7019bd0 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Sun, 26 Apr 2026 17:00:01 -0700 Subject: [PATCH 2/2] add missing parentheses --- python/tests/test_dump_load.py | 8 ++++---- python/tests/test_simulation.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/python/tests/test_dump_load.py b/python/tests/test_dump_load.py index 78c960316..d21f371a4 100644 --- a/python/tests/test_dump_load.py +++ b/python/tests/test_dump_load.py @@ -120,7 +120,7 @@ def test_load_dump_structure_2d(self): self._load_dump_structure_2d() @unittest.skipIf( - not mp.with_mpi() or mp.count_processors < 2, + not mp.with_mpi() or mp.count_processors() < 2, "MPI specific test (requires mpirun with more than 1 process)", ) def test_load_dump_structure_sharded_2d(self): @@ -230,7 +230,7 @@ def test_load_dump_structure_3d(self): self._load_dump_structure_3d() @unittest.skipIf( - not mp.with_mpi() or mp.count_processors < 2, + not mp.with_mpi() or mp.count_processors() < 2, "MPI specific test (requires mpirun with more than 1 process)", ) def test_load_dump_structure_sharded_3d(self): @@ -355,7 +355,7 @@ def test_load_dump_fields_2d(self): self._load_dump_fields_2d() @unittest.skipIf( - not mp.with_mpi() or mp.count_processors < 2, + not mp.with_mpi() or mp.count_processors() < 2, "MPI specific test (requires mpirun with more than 1 process)", ) def test_load_dump_fields_sharded_2d(self): @@ -478,7 +478,7 @@ def test_load_dump_fields_3d(self): self._load_dump_fields_3d() @unittest.skipIf( - not mp.with_mpi() or mp.count_processors < 2, + not mp.with_mpi() or mp.count_processors() < 2, "MPI specific test (requires mpirun with more than 1 process)", ) def test_load_dump_fields_sharded_3d(self): diff --git a/python/tests/test_simulation.py b/python/tests/test_simulation.py index 843ff89c2..8a550c18a 100644 --- a/python/tests/test_simulation.py +++ b/python/tests/test_simulation.py @@ -220,7 +220,7 @@ def init_simple_simulation(self, **kwargs): ) @unittest.skipIf( - not mp.with_mpi() or mp.count_processors < 2, + not mp.with_mpi() or mp.count_processors() < 2, "MPI specific test (requires mpirun with more than 1 process)", ) def test_mpi(self):