Skip to content
Merged
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 @@ -64,6 +64,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
14 changes: 14 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sys
from packaging.version import Version
from platform import python_version

import pytest

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


# 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'))
3 changes: 1 addition & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from functools import partial
import textwrap
from functools import partial
from packaging.version import Version

import pytest
import numpy as np


# Keep this until we require numpy to be >=2.0 or there is a directive in doctestplus
# to support multiple ways of repr
if Version(np.__version__) >= Version("2.0.dev"):
Expand Down
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