Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX: print reasons for skipping tests #378

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 6 additions & 3 deletions tests/sympy/test_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
Loading