Skip to content

Commit da72892

Browse files
authored
Merge pull request #185 from scipy/visible_dep_warning
Stop filtering VisibleDeprecationWarning from numpy
2 parents b9ba944 + e3d87be commit da72892

File tree

3 files changed

+7
-26
lines changed

3 files changed

+7
-26
lines changed

.github/workflows/pip.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
strategy:
1717
matrix:
1818
python-version: ['3.11', '3.12']
19-
numpy: ['"numpy<2.2"', 'numpy']
19+
numpy: ['"numpy<2.0"', 'numpy']
2020
os: [ubuntu-latest]
21-
pytest: ['"pytest<8.0"', pytest]
21+
pytest: [pytest]
2222
pre: ['', '--pre']
2323

2424
steps:
@@ -36,7 +36,7 @@ jobs:
3636
python -m pip install --upgrade pip
3737
python -m pip install ${{matrix.pytest}} ${{matrix.pre}}
3838
python -m pip install -e . ${{matrix.pre}}
39-
python -m pip install ${{matrix.numpy}}
39+
python -m pip install ${{matrix.numpy}} ${{matrix.pre}}
4040
4141
- name: Echo versions
4242
run: |

scipy_doctest/impl.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99

1010
from . import util
1111

12-
13-
## shim numpy 1.x vs 2.0
14-
if np.__version__ < "2":
15-
VisibleDeprecationWarning = np.VisibleDeprecationWarning
16-
else:
17-
VisibleDeprecationWarning = np.exceptions.VisibleDeprecationWarning
18-
19-
2012
# Register the optionflag to skip whole blocks, i.e.
2113
# sequences of Examples without an intervening text.
2214
SKIPBLOCK = doctest.register_optionflag('SKIPBLOCK')
@@ -332,13 +324,8 @@ def check_output(self, want, got, optionflags):
332324
# OK then, convert strings to objects
333325
ns = dict(self.config.check_namespace)
334326
try:
335-
with warnings.catch_warnings():
336-
# NumPy's ragged array deprecation of np.array([1, (2, 3)]);
337-
# also array abbreviations: try `np.diag(np.arange(1000))`
338-
warnings.simplefilter('ignore', VisibleDeprecationWarning)
339-
340-
a_want = eval(want, dict(ns))
341-
a_got = eval(got, dict(ns))
327+
a_want = eval(want, dict(ns))
328+
a_got = eval(got, dict(ns))
342329
except Exception:
343330
# Maybe we're printing a numpy array? This produces invalid python
344331
# code: `print(np.arange(3))` produces "[0 1 2]" w/o commas between
@@ -433,12 +420,8 @@ def _do_check(self, want, got, strict_check):
433420
except Exception:
434421
pass
435422

436-
with warnings.catch_warnings():
437-
# NumPy's ragged array deprecation of np.array([1, (2, 3)])
438-
warnings.simplefilter('ignore', VisibleDeprecationWarning)
439-
440-
# This line is the crux of the whole thing. The rest is mostly scaffolding.
441-
result = np.allclose(want, got, atol=self.atol, rtol=self.rtol, equal_nan=True)
423+
# This line is the crux of the whole thing. The rest is mostly scaffolding.
424+
result = np.allclose(want, got, atol=self.atol, rtol=self.rtol, equal_nan=True)
442425
return result
443426

444427

scipy_doctest/tests/module_cases.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
'func7', 'manip_printoptions', 'array_abbreviation'
44
]
55

6-
import numpy as np
7-
import pytest
86

97
def func():
108
"""

0 commit comments

Comments
 (0)