|
4 | 4 | from importlib.util import find_spec |
5 | 5 | from pathlib import Path |
6 | 6 |
|
| 7 | +import matplotlib |
7 | 8 | import pytest |
8 | 9 | import yaml |
| 10 | +from packaging.version import Version |
9 | 11 |
|
10 | 12 | from yt.config import ytcfg |
11 | 13 | from yt.utilities.answer_testing.testing_utilities import ( |
|
17 | 19 | data_dir_load, |
18 | 20 | ) |
19 | 21 |
|
| 22 | +MPL_VERSION = Version(matplotlib.__version__) |
| 23 | + |
20 | 24 |
|
21 | 25 | def pytest_addoption(parser): |
22 | 26 | """ |
@@ -109,22 +113,26 @@ def pytest_configure(config): |
109 | 113 | ): |
110 | 114 | config.addinivalue_line("filterwarnings", value) |
111 | 115 |
|
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 | + |
123 | 125 | 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 |
126 | 129 | 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 | + ), |
128 | 136 | ) |
129 | 137 |
|
130 | 138 | if find_spec("cartopy") is not None: |
|
0 commit comments