MilesCranmer commited on
Commit
54c02c4
1 Parent(s): e05d2e2

Explicit test for user warning

Browse files
.github/workflows/CI_conda.yml CHANGED
@@ -67,6 +67,8 @@ jobs:
67
  conda install -c conda-forge $(cat requirements.txt | grep -v "julia" | xargs echo | sed "s/_/-/g")
68
  pip install .
69
  python -c 'import pysr; pysr.install()'
 
 
70
  - name: "Install Coverage tool"
71
  run: pip install coverage coveralls
72
  - name: "Run tests"
 
67
  conda install -c conda-forge $(cat requirements.txt | grep -v "julia" | xargs echo | sed "s/_/-/g")
68
  pip install .
69
  python -c 'import pysr; pysr.install()'
70
+ - name: "Ensure that static libpython warning appears"
71
+ run: python test/test_static_libpython_warning.py
72
  - name: "Install Coverage tool"
73
  run: pip install coverage coveralls
74
  - name: "Run tests"
test/test_static_libpython_warning.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Test that running PySR with static libpython raises a warning."""
2
+
3
+ import warnings
4
+ import pysr
5
+
6
+ with warnings.catch_warnings(record=True) as warning_catcher:
7
+ warnings.simplefilter("always")
8
+ pysr.sr.init_julia()
9
+
10
+ assert len(warning_catcher) == 1
11
+ assert issubclass(warning_catcher[-1].category, UserWarning)
12
+ assert "static" in str(warning_catcher[-1].message)