Skip to content

Commit

Permalink
Tolerate NumPy deprecation warnings when using older SciPy.
Browse files Browse the repository at this point in the history
Simply importing scipy 1.2.3 with NumPy 1.21.5 leads to deprecation
warnings. Tolerate these in pytest.
  • Loading branch information
hawkinsp committed Jan 31, 2022
1 parent abc339b commit 541f762
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
# limitations under the License.
"""pytest configuration"""

import jax
import numpy
import pytest


@pytest.fixture(autouse=True)
def add_imports(doctest_namespace):
import jax
import numpy
doctest_namespace["jax"] = jax
doctest_namespace["lax"] = jax.lax
doctest_namespace["jnp"] = jax.numpy
Expand Down
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@ filterwarnings =
ignore:jax.experimental.* is deprecated, import jax.example_libraries.* instead:FutureWarning
# numpy uses distutils which is deprecated
ignore:The distutils.* is deprecated.*:DeprecationWarning
# numpy deprecation warnings that can be triggered by an old SciPy version on NumPy 1.21.
# TODO(phawkins): Remove these when the minimum scipy version no longer triggers these
# (seen on scipy 1.2.3).
ignore:`np.*` is a deprecated alias for.*:DeprecationWarning
ignore:The module numpy.dual is deprecated.*:DeprecationWarning
doctest_optionflags = NUMBER NORMALIZE_WHITESPACE
addopts = --doctest-glob="*.rst"

0 comments on commit 541f762

Please sign in to comment.