diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-09-06 13:17:12 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2018-09-06 16:52:20 -0600 |
commit | 3f111a429195c3b892240bb22a67e39cf2230bdd (patch) | |
tree | c48ea9bd35cc6e4e4983e6c29be262a8cd635e47 /numpy/_pytesttester.py | |
parent | b8f3be9e35bf81dfdd595cf99d3ec28a84d5fec7 (diff) | |
download | numpy-3f111a429195c3b892240bb22a67e39cf2230bdd.tar.gz |
BUG: Fix matrix PendingDeprecationWarning suppression for pytest 3.8+.
Pytest < 3.8 ignored warnings issued during test collection, but that
changed in pytest 3.8 and the method NumPy used to suppress the
PendingDeprecationWarning for matrices no longer worked, or rather, was
exposed as not working. The fix here is to suppress the warning in
pytest.ini and pytesttester.py , which should work as long as the tests
are the only places left where NumPy uses matrices.
An alternate fix is to delay the construction of matrices in the tests
until they are actually run, which has the virtue of test localization
but is a bit more complicated.
See https://github.com/pytest-dev/pytest/issues/3945 for discussion.
Diffstat (limited to 'numpy/_pytesttester.py')
-rw-r--r-- | numpy/_pytesttester.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/numpy/_pytesttester.py b/numpy/_pytesttester.py index 6a1b3274e..30ecc69c7 100644 --- a/numpy/_pytesttester.py +++ b/numpy/_pytesttester.py @@ -160,6 +160,24 @@ class PytestTester(object): "-W ignore::UserWarning:cpuinfo", ] + # When testing matrices, ignore their PendingDeprecationWarnings + pytest_args += [ + "-W ignore:the matrix subclass is not", + ] + + # Ignore python2.7 -3 warnings + pytest_args += [ + r"-W ignore:sys\.exc_clear\(\) not supported in 3\.x:DeprecationWarning", + r"-W ignore:in 3\.x, __setslice__:DeprecationWarning", + r"-W ignore:in 3\.x, __getslice__:DeprecationWarning", + r"-W ignore:buffer\(\) not supported in 3\.x:DeprecationWarning", + r"-W ignore:CObject type is not supported in 3\.x:DeprecationWarning", + r"-W ignore:comparing unequal types not supported in 3\.x:DeprecationWarning", + r"-W ignore:the commands module has been removed in Python 3\.0:DeprecationWarning", + r"-W ignore:The 'new' module has been removed in Python 3\.0:DeprecationWarning", + ] + + if doctests: raise ValueError("Doctests not supported") |