From 1fe416318d7905856e76151065cd1b495a15ff31 Mon Sep 17 00:00:00 2001 From: Olivier Ramonat Date: Tue, 26 Mar 2024 14:02:13 +0100 Subject: [PATCH] Do not use assert to skip a test but rely on skipif() Otherwise, we get an error when running the testsuite. Also adjust pytest.mark.skipif to enable test_rlimit_foreground_option on macOS. --- tests/tests_e3/os/process/main_test.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/tests_e3/os/process/main_test.py b/tests/tests_e3/os/process/main_test.py index e9168868..b6b2ecce 100644 --- a/tests/tests_e3/os/process/main_test.py +++ b/tests/tests_e3/os/process/main_test.py @@ -120,7 +120,7 @@ def run_test(): e.restore() -@pytest.mark.skipif(sys.platform == "win32", reason="A linux test") +@pytest.mark.skipif(sys.platform == "win32", reason="A linux/macOS test") def test_rlimit_ctrl_c(): """Test rlimit CTRL-C. @@ -164,9 +164,6 @@ def test_rlimit_ctrl_c(): except ImportError: raise ImportError("ptyprocess is needed to run this tests") from None - # Only a linux test - assert sys.platform.startswith("linux"), "This test make sens only on linux" - script_to_run = """ from __future__ import annotations @@ -193,7 +190,7 @@ def test_rlimit_ctrl_c(): assert int(end - start) < 30, f"CTRL-C failed: take {int(end - start)} seconds" -@pytest.mark.skipif(sys.platform == "win32", reason="A linux test") +@pytest.mark.skipif(sys.platform != "linux", reason="A linux test") def test_rlimit_foreground_option(): """Test rlimit --foreground. @@ -204,9 +201,6 @@ def test_rlimit_foreground_option(): except ImportError: raise ImportError("ptyprocess is needed to run this tests") from None - # Only a linux test - assert sys.platform.startswith("linux"), "This test make sens only on linux" - # Test with --foreground os.environ["PS1"] = "$ " # Use TERM=dummy to avoid prompt coloring to interfere with the result