Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
- os: windows-latest
python-version: '3.14'
toxenv: py314-test-pytestdev
posargs: -v
- os: macos-latest
python-version: '3.14'
toxenv: py314-test-pytestdev
Expand Down
12 changes: 11 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from functools import partial
import sys
import textwrap
from functools import partial
from packaging.version import Version
from platform import python_version

import pytest
import numpy as np

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

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

return make


# Windows + Python 3.14.0 + pytest-dev have ResourceWarning, see
# https://github.com/scientific-python/pytest-doctestplus/issues/305
def pytest_runtestloop(session):
if sys.platform == 'win32' and python_version() == "3.14.0" and not PYTEST_LT_8_5:
session.add_marker(pytest.mark.filterwarnings('ignore::ResourceWarning'))
10 changes: 1 addition & 9 deletions tests/test_doctestplus.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import glob
import os
import sys
import warnings
from platform import python_version
from textwrap import dedent

Expand All @@ -26,7 +25,6 @@


PYTEST_LT_6 = Version(pytest.__version__) < Version('6.0.0')
PYTEST_LT_8_5 = Version(pytest.__version__) < Version('8.5.0.dev')


def test_ignored_whitespace(testdir):
Expand Down Expand Up @@ -732,13 +730,7 @@ def f():
testdir.makefile('.rst', foo='>>> 1+1\n2')

testdir.inline_run('--doctest-plus').assertoutcome(passed=2)
if os.name == "nt" and python_version() == "3.14.0" and not PYTEST_LT_8_5:
with warnings.catch_warnings():
# ResourceWarning unclosed file pytest.EXE --> PytestUnraisableExceptionWarning
warnings.filterwarnings("ignore")
testdir.inline_run('--doctest-plus', '--doctest-rst').assertoutcome(passed=3)
else:
testdir.inline_run('--doctest-plus', '--doctest-rst').assertoutcome(passed=3)
testdir.inline_run('--doctest-plus', '--doctest-rst').assertoutcome(passed=3)
testdir.inline_run(
'--doctest-plus', '--doctest-rst', '--ignore', '.'
).assertoutcome(passed=0)
Expand Down
Loading