Skip to content

Commit 657887d

Browse files
committed
TST: Try move Windows stuff
to root level conftest.py
1 parent 4227e18 commit 657887d

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import sys
2+
from packaging.version import Version
3+
from platform import python_version
4+
5+
import pytest
6+
7+
PYTEST_LT_8_5 = Version(pytest.__version__) < Version('8.5.0.dev')
8+
9+
10+
# Windows + Python 3.14.0 + pytest-dev have ResourceWarning, see
11+
# https://github.com/scientific-python/pytest-doctestplus/issues/305
12+
def pytest_runtestloop(session):
13+
if sys.platform == 'win32' and python_version() == "3.14.0" and not PYTEST_LT_8_5:
14+
session.add_marker(pytest.mark.filterwarnings('ignore::ResourceWarning'))

tests/conftest.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
import sys
21
import textwrap
32
from functools import partial
43
from packaging.version import Version
5-
from platform import python_version
64

75
import pytest
86
import numpy as np
97

10-
PYTEST_LT_8_5 = Version(pytest.__version__) < Version('8.5.0.dev')
11-
128
# Keep this until we require numpy to be >=2.0 or there is a directive in doctestplus
139
# to support multiple ways of repr
1410
if Version(np.__version__) >= Version("2.0.dev"):
@@ -56,10 +52,3 @@ def make(*args, **kwargs):
5652
return testdir.makefile('.rst', *args, **kwargs)
5753

5854
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)