From 8b27cee7cbe4c03e657b55ab4010472d26ab1d8b Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Thu, 21 Dec 2023 14:08:32 +0100 Subject: [PATCH 1/2] DX: print reasons for skipping tests --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9abb45f87..0c7eb4d9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -242,7 +242,9 @@ addopts = ''' --durations=3 --ignore=docs/abbreviate_signature.py --ignore=docs/conf.py --m "not slow"''' +-m "not slow" +-rS +''' filterwarnings = [ "error", "ignore:.*invalid value encountered in sqrt.*:RuntimeWarning", From cae4c0d725fbe6bf7b5531b99388b735cb68bfc6 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Thu, 21 Dec 2023 14:12:14 +0100 Subject: [PATCH 2/2] MAINT: improve skip logic --- tests/sympy/test_caching.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/sympy/test_caching.py b/tests/sympy/test_caching.py index c9f2eebf5..88ad75298 100644 --- a/tests/sympy/test_caching.py +++ b/tests/sympy/test_caching.py @@ -27,13 +27,14 @@ ) def test_get_readable_hash(assumptions, expected_hash, caplog: LogCaptureFixture): if sys.version_info < (3, 8) or sys.version_info >= (3, 11): - pytest.skip("Cannot run this test on Python 3.7") + python_version = ".".join(map(str, sys.version_info[:2])) + pytest.skip(f"Cannot run this test on Python {python_version}") caplog.set_level(logging.WARNING) x, y = sp.symbols("x y", **assumptions) expr = x**2 + y h = get_readable_hash(expr) python_hash_seed = os.environ.get("PYTHONHASHSEED") - if python_hash_seed is None or not python_hash_seed.isdigit(): + if python_hash_seed is None: assert h[:7] == "bbc9833" if _warn_about_unsafe_hash.cache_info().hits == 0: assert "PYTHONHASHSEED has not been set." in caplog.text @@ -60,7 +61,9 @@ def test_get_readable_hash_energy_dependent_width(): h = get_readable_hash(expr) python_hash_seed = os.environ.get("PYTHONHASHSEED") if python_hash_seed is None: - pytest.skip("PYTHONHASHSEED has been set, but is not 0") + pytest.skip("PYTHONHASHSEED has not been set") + if python_hash_seed != "0": + pytest.skip(f"PYTHONHASHSEED is not set to 0, but to {python_hash_seed}") if sys.version_info < (3, 8): assert h == "pythonhashseed-0+6939334787254793397" elif sys.version_info >= (3, 11):