Skip to content

Commit

Permalink
Do not use assert to skip a test but rely on skipif()
Browse files Browse the repository at this point in the history
Otherwise, we get an error when running the testsuite.

Also adjust pytest.mark.skipif to enable test_rlimit_foreground_option
on macOS.
  • Loading branch information
enzbang committed Mar 26, 2024
1 parent 1f6fac4 commit 1fe4163
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions tests/tests_e3/os/process/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 1fe4163

Please sign in to comment.