PySR / test /test_static_libpython_warning.py
MilesCranmer's picture
Add code citation
16f91b6
raw
history blame
439 Bytes
"""Test that running PySR with static libpython raises a warning."""
import warnings
import pysr
# Taken from https://stackoverflow.com/a/14463362/2689923
with warnings.catch_warnings(record=True) as warning_catcher:
warnings.simplefilter("always")
pysr.sr.init_julia()
assert len(warning_catcher) == 1
assert issubclass(warning_catcher[-1].category, UserWarning)
assert "static" in str(warning_catcher[-1].message)