Skip to content

Commit

Permalink
Limit TimeConstrained tests if unpatched stopit (#1302)
Browse files Browse the repository at this point in the history
Some of the `TimeConstrained[]` tests do not work if we have the last
PyPI distributed stopit.
  • Loading branch information
rocky authored Jan 18, 2025
1 parent 367b4bd commit 483e301
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/builtin/test_datentime.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@

import pytest

try:
from stopit import __version__ as stopit_version
except ImportError:
have_stopit_for_timeconstrained = False
else:
have_stopit_for_timeconstrained = stopit_version.split(".")[:3] >= ["1", "1", "3"]


@pytest.mark.skipif(
sys.platform in ("emscripten",),
reason="TimeConstrained is not supported in Pyodide",
reason="TimeRemaining[] is not supported in Pyodide",
)
def test_timeremaining():
str_expr = "TimeConstrained[1+2; TimeRemaining[], 0.9]"
Expand All @@ -22,7 +29,7 @@ def test_timeremaining():

@pytest.mark.skipif(
sys.platform in ("emscripten",),
reason="TimeConstrained is not supported in Pyodide",
reason="TimeConstrained[] is not supported in Pyodide",
)
def test_timeconstrained1():
"""
Expand Down Expand Up @@ -144,8 +151,8 @@ def test_private_doctests_datetime(str_expr, msgs, str_expected, fail_msg):


@pytest.mark.skipif(
sys.platform in ("emscripten",),
reason="TimeConstrained is not supported in Piodide",
sys.platform in ("emscripten",) or not have_stopit_for_timeconstrained,
reason="TimeConstrained[] is not supported in Pyodide or an unpatched 'stopit'",
)
@pytest.mark.parametrize(
("str_expr", "msgs", "str_expected", "fail_msg"),
Expand Down

0 comments on commit 483e301

Please sign in to comment.