Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a5bfc9b

Browse files
committed
Try to fix Pytest error on Python 3.13
1 parent 9699b3e commit a5bfc9b

3 files changed

Lines changed: 25 additions & 21 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
env:
8585
COLUMNS: 120
8686
run: |
87-
pytest --color=yes -raXxs ${{ startsWith(matrix.python-version, 'pypy') && ' ' || '--cov --cov-report=xml' }} --json-report --json-report-file=./report-${{ matrix.python-version }}-${{runner.os}}.json
87+
pytest --color=yes -raXxs ${{ startsWith(matrix.python-version, 'pypy') && ' ' || '--cov --cov-report=xml' }} --json-report --json-report-file=./report-${{ matrix.python-version }}-${{runner.os}}.json --maxfail=15
8888
- uses: actions/upload-artifact@v3
8989
with:
9090
name: upload pytest timing reports as json

IPython/testing/plugin/pytest_ipdoctest.py

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#
55
# Copyright (c) 2004-2021 Holger Krekel and others
66
"""Discover and run ipdoctests in modules and test files."""
7-
import builtins
87
import bdb
8+
import builtins
99
import inspect
1010
import os
1111
import platform
@@ -15,40 +15,41 @@
1515
import warnings
1616
from contextlib import contextmanager
1717
from pathlib import Path
18-
from typing import Any
19-
from typing import Callable
20-
from typing import Dict
21-
from typing import Generator
22-
from typing import Iterable
23-
from typing import List
24-
from typing import Optional
25-
from typing import Pattern
26-
from typing import Sequence
27-
from typing import Tuple
28-
from typing import Type
29-
from typing import TYPE_CHECKING
30-
from typing import Union
18+
from typing import (
19+
TYPE_CHECKING,
20+
Any,
21+
Callable,
22+
Dict,
23+
Generator,
24+
Iterable,
25+
List,
26+
Optional,
27+
Pattern,
28+
Sequence,
29+
Tuple,
30+
Type,
31+
Union,
32+
)
3133

3234
import pytest
3335
from _pytest import outcomes
34-
from _pytest._code.code import ExceptionInfo
35-
from _pytest._code.code import ReprFileLocation
36-
from _pytest._code.code import TerminalRepr
36+
from _pytest._code.code import ExceptionInfo, ReprFileLocation, TerminalRepr
3737
from _pytest._io import TerminalWriter
3838
from _pytest.compat import safe_getattr
3939
from _pytest.config import Config
4040
from _pytest.config.argparsing import Parser
4141
from _pytest.fixtures import FixtureRequest
4242
from _pytest.nodes import Collector
4343
from _pytest.outcomes import OutcomeException
44-
from _pytest.pathlib import fnmatch_ex
45-
from _pytest.pathlib import import_path
44+
from _pytest.pathlib import fnmatch_ex, import_path
4645
from _pytest.python_api import approx
4746
from _pytest.warning_types import PytestWarning
4847

4948
if TYPE_CHECKING:
5049
import doctest
5150

51+
from .ipdoctest import IPDoctestOutputChecker
52+
5253
DOCTEST_REPORT_CHOICE_NONE = "none"
5354
DOCTEST_REPORT_CHOICE_CDIFF = "cdiff"
5455
DOCTEST_REPORT_CHOICE_NDIFF = "ndiff"
@@ -271,6 +272,8 @@ def _get_runner(
271272

272273

273274
class IPDoctestItem(pytest.Item):
275+
_user_ns_orig: Dict[str, Any]
276+
274277
def __init__(
275278
self,
276279
name: str,
@@ -283,6 +286,7 @@ def __init__(
283286
self.dtest = dtest
284287
self.obj = None
285288
self.fixture_request: Optional[FixtureRequest] = None
289+
self._user_ns_orig = {}
286290

287291
@classmethod
288292
def from_parent( # type: ignore

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ doc =
5252
docrepr
5353
matplotlib
5454
stack_data
55-
pytest
55+
pytest<8
5656
typing_extensions
5757
exceptiongroup
5858
%(test)s

0 commit comments

Comments
 (0)