Skip to content

Commit 4227e18

Browse files
pllimbsipocz
andcommitted
TST: Localize ResourceWarning ignore.
Co-authored-by: Brigitta Sipőcz <[email protected]>
1 parent b92fa5e commit 4227e18

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ filterwarnings =
6161
# For pytest-asyncio deprecations that is expected to be resolved upstream
6262
# https://github.com/pytest-dev/pytest-asyncio/issues/924
6363
ignore:The configuration option "asyncio_default_fixture_loop_scope":pytest.PytestDeprecationWarning
64-
# Windows + Python 3.14 + pytest-dev have ResourceWarning, see
65-
# https://github.com/scientific-python/pytest-doctestplus/issues/305
66-
ignore::ResourceWarning
6764

6865
[flake8]
6966
max-line-length = 100

tests/conftest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
from functools import partial
1+
import sys
22
import textwrap
3+
from functools import partial
34
from packaging.version import Version
5+
from platform import python_version
46

57
import pytest
68
import numpy as np
79

10+
PYTEST_LT_8_5 = Version(pytest.__version__) < Version('8.5.0.dev')
811

912
# Keep this until we require numpy to be >=2.0 or there is a directive in doctestplus
1013
# to support multiple ways of repr
@@ -53,3 +56,10 @@ def make(*args, **kwargs):
5356
return testdir.makefile('.rst', *args, **kwargs)
5457

5558
return make
59+
60+
61+
# Windows + Python 3.14.0 + pytest-dev have ResourceWarning, see
62+
# https://github.com/scientific-python/pytest-doctestplus/issues/305
63+
def pytest_runtestloop(session):
64+
if sys.platform == 'win32' and python_version() == "3.14.0" and not PYTEST_LT_8_5:
65+
session.add_marker(pytest.mark.filterwarnings('ignore::ResourceWarning'))

0 commit comments

Comments
 (0)