Skip to content

Commit b64eeee

Browse files
committed
TST: Backports from GH-3743
1 parent 6426de4 commit b64eeee

1 file changed

Lines changed: 22 additions & 14 deletions

File tree

conftest.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
from importlib.util import find_spec
55
from pathlib import Path
66

7+
import matplotlib
78
import pytest
89
import yaml
10+
from packaging.version import Version
911

1012
from yt.config import ytcfg
1113
from yt.utilities.answer_testing.testing_utilities import (
@@ -17,6 +19,8 @@
1719
data_dir_load,
1820
)
1921

22+
MPL_VERSION = Version(matplotlib.__version__)
23+
2024

2125
def pytest_addoption(parser):
2226
"""
@@ -109,22 +113,26 @@ def pytest_configure(config):
109113
):
110114
config.addinivalue_line("filterwarnings", value)
111115

112-
# at the time of writing, astropy's wheels are behind numpy's latest
113-
# version but this doesn't cause actual problems in our test suite, so
114-
# we allow this warning to pass.
115-
# last checked with astropy 4.2.1
116-
config.addinivalue_line(
117-
"filterwarnings",
118-
(
119-
"ignore:numpy.ndarray size changed, may indicate binary incompatibility. "
120-
"Expected 80 from C header, got 88 from PyObject:RuntimeWarning"
121-
),
122-
)
116+
if MPL_VERSION < Version("3.0.0"):
117+
config.addinivalue_line(
118+
"filterwarnings",
119+
(
120+
"ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' "
121+
"is deprecated since Python 3.3,and in 3.9 it will stop working:DeprecationWarning"
122+
),
123+
)
124+
123125
if find_spec("astropy") is not None:
124-
# astropy triggers this warning from itself, there's not much we can do on our side
125-
# last checked with astropy 4.2.1
126+
# at the time of writing, astropy's wheels are behind numpy's latest
127+
# version but this doesn't cause actual problems in our test suite
128+
# last updated with astropy 5.0 + numpy 1.22 + pytest 6.2.5
126129
config.addinivalue_line(
127-
"filterwarnings", "ignore::astropy.wcs.wcs.FITSFixedWarning"
130+
"filterwarnings",
131+
(
132+
"ignore:numpy.ndarray size changed, may indicate binary incompatibility. Expected "
133+
r"(80 from C header, got 88|88 from C header, got 96|80 from C header, got 96)"
134+
" from PyObject:RuntimeWarning"
135+
),
128136
)
129137

130138
if find_spec("cartopy") is not None:

0 commit comments

Comments
 (0)