From d0d9a5b2f36a2390a251a498e78e2c51b66feaef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20S=2E=20Dokken?= Date: Wed, 20 Nov 2024 09:00:04 +0100 Subject: [PATCH] Add skip if system doesn't have sufficient number of CPUs --- tests/test_original_checkpoint.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_original_checkpoint.py b/tests/test_original_checkpoint.py index d6f63b3..8bf120a 100644 --- a/tests/test_original_checkpoint.py +++ b/tests/test_original_checkpoint.py @@ -1,5 +1,6 @@ from __future__ import annotations +import os import itertools from collections.abc import Callable from pathlib import Path @@ -270,6 +271,9 @@ def read_function_vector( np.testing.assert_allclose(u.x.array, u_ex.x.array, atol=atol) # type: ignore +@pytest.mark.skipif( + os.cpu_count() == 1, reason="Test requires that the system has more than one process" +) @pytest.mark.skipif(MPI.COMM_WORLD.size > 1, reason="Test uses ipythonparallel for MPI") @pytest.mark.parametrize("is_complex", [True, False]) @pytest.mark.parametrize("family", ["Lagrange", "DG"]) @@ -314,6 +318,9 @@ def f(x): assert query.successful(), query.error +@pytest.mark.skipif( + os.cpu_count() == 1, reason="Test requires that the system has more than one process" +) @pytest.mark.skipif(MPI.COMM_WORLD.size > 1, reason="Test uses ipythonparallel for MPI") @pytest.mark.parametrize("is_complex", [True, False]) @pytest.mark.parametrize("family", ["Lagrange", "DG"]) @@ -360,6 +367,9 @@ def f(x): assert query.successful(), query.error +@pytest.mark.skipif( + os.cpu_count() == 1, reason="Test requires that the system has more than one process" +) @pytest.mark.skipif(MPI.COMM_WORLD.size > 1, reason="Test uses ipythonparallel for MPI") @pytest.mark.parametrize("write_mesh", [True, False]) @pytest.mark.parametrize("is_complex", [True, False]) @@ -397,6 +407,9 @@ def f(x): read_function_vector(mesh_fname, file_path, "u_original", family, degree, f, f_dtype) +@pytest.mark.skipif( + os.cpu_count() == 1, reason="Test requires that the system has more than one process" +) @pytest.mark.skipif(MPI.COMM_WORLD.size > 1, reason="Test uses ipythonparallel for MPI") @pytest.mark.parametrize("write_mesh", [True, False]) @pytest.mark.parametrize("is_complex", [True, False]) @@ -435,6 +448,9 @@ def f(x): read_function_vector(mesh_fname, file_path, "u_original", family, degree, f, f_dtype) +@pytest.mark.skipif( + os.cpu_count() == 1, reason="Test requires that the system has more than one process" +) @pytest.mark.skipif(MPI.COMM_WORLD.size > 1, reason="Test uses ipythonparallel for MPI") @pytest.mark.parametrize("write_mesh", [True, False]) @pytest.mark.parametrize("is_complex", [True, False]) @@ -472,6 +488,9 @@ def f(x): read_function_vector(mesh_fname, file_path, "u_original", family, degree, f, f_dtype) +@pytest.mark.skipif( + os.cpu_count() == 1, reason="Test requires that the system has more than one process" +) @pytest.mark.skipif(MPI.COMM_WORLD.size > 1, reason="Test uses ipythonparallel for MPI") @pytest.mark.parametrize("write_mesh", [True, False]) @pytest.mark.parametrize("is_complex", [True, False])