##// END OF EJS Templates
Try to fix Pytest error on Python 3.13
Matthias Bussonnier -
Show More
@@ -84,7 +84,7 b' jobs:'
84 env:
84 env:
85 COLUMNS: 120
85 COLUMNS: 120
86 run: |
86 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
88 - uses: actions/upload-artifact@v3
88 - uses: actions/upload-artifact@v3
89 with:
89 with:
90 name: upload pytest timing reports as json
90 name: upload pytest timing reports as json
@@ -4,8 +4,8 b''
4 #
4 #
5 # Copyright (c) 2004-2021 Holger Krekel and others
5 # Copyright (c) 2004-2021 Holger Krekel and others
6 """Discover and run ipdoctests in modules and test files."""
6 """Discover and run ipdoctests in modules and test files."""
7 import builtins
8 import bdb
7 import bdb
8 import builtins
9 import inspect
9 import inspect
10 import os
10 import os
11 import platform
11 import platform
@@ -15,25 +15,25 b' import types'
15 import warnings
15 import warnings
16 from contextlib import contextmanager
16 from contextlib import contextmanager
17 from pathlib import Path
17 from pathlib import Path
18 from typing import Any
18 from typing import (
19 from typing import Callable
19 TYPE_CHECKING,
20 from typing import Dict
20 Any,
21 from typing import Generator
21 Callable,
22 from typing import Iterable
22 Dict,
23 from typing import List
23 Generator,
24 from typing import Optional
24 Iterable,
25 from typing import Pattern
25 List,
26 from typing import Sequence
26 Optional,
27 from typing import Tuple
27 Pattern,
28 from typing import Type
28 Sequence,
29 from typing import TYPE_CHECKING
29 Tuple,
30 from typing import Union
30 Type,
31 Union,
32 )
31
33
32 import pytest
34 import pytest
33 from _pytest import outcomes
35 from _pytest import outcomes
34 from _pytest._code.code import ExceptionInfo
36 from _pytest._code.code import ExceptionInfo, ReprFileLocation, TerminalRepr
35 from _pytest._code.code import ReprFileLocation
36 from _pytest._code.code import TerminalRepr
37 from _pytest._io import TerminalWriter
37 from _pytest._io import TerminalWriter
38 from _pytest.compat import safe_getattr
38 from _pytest.compat import safe_getattr
39 from _pytest.config import Config
39 from _pytest.config import Config
@@ -41,14 +41,15 b' from _pytest.config.argparsing import Parser'
41 from _pytest.fixtures import FixtureRequest
41 from _pytest.fixtures import FixtureRequest
42 from _pytest.nodes import Collector
42 from _pytest.nodes import Collector
43 from _pytest.outcomes import OutcomeException
43 from _pytest.outcomes import OutcomeException
44 from _pytest.pathlib import fnmatch_ex
44 from _pytest.pathlib import fnmatch_ex, import_path
45 from _pytest.pathlib import import_path
46 from _pytest.python_api import approx
45 from _pytest.python_api import approx
47 from _pytest.warning_types import PytestWarning
46 from _pytest.warning_types import PytestWarning
48
47
49 if TYPE_CHECKING:
48 if TYPE_CHECKING:
50 import doctest
49 import doctest
51
50
51 from .ipdoctest import IPDoctestOutputChecker
52
52 DOCTEST_REPORT_CHOICE_NONE = "none"
53 DOCTEST_REPORT_CHOICE_NONE = "none"
53 DOCTEST_REPORT_CHOICE_CDIFF = "cdiff"
54 DOCTEST_REPORT_CHOICE_CDIFF = "cdiff"
54 DOCTEST_REPORT_CHOICE_NDIFF = "ndiff"
55 DOCTEST_REPORT_CHOICE_NDIFF = "ndiff"
@@ -271,6 +272,8 b' def _get_runner('
271
272
272
273
273 class IPDoctestItem(pytest.Item):
274 class IPDoctestItem(pytest.Item):
275 _user_ns_orig: Dict[str, Any]
276
274 def __init__(
277 def __init__(
275 self,
278 self,
276 name: str,
279 name: str,
@@ -283,6 +286,7 b' class IPDoctestItem(pytest.Item):'
283 self.dtest = dtest
286 self.dtest = dtest
284 self.obj = None
287 self.obj = None
285 self.fixture_request: Optional[FixtureRequest] = None
288 self.fixture_request: Optional[FixtureRequest] = None
289 self._user_ns_orig = {}
286
290
287 @classmethod
291 @classmethod
288 def from_parent( # type: ignore
292 def from_parent( # type: ignore
@@ -52,7 +52,7 b' doc ='
52 docrepr
52 docrepr
53 matplotlib
53 matplotlib
54 stack_data
54 stack_data
55 pytest
55 pytest<8
56 typing_extensions
56 typing_extensions
57 exceptiongroup
57 exceptiongroup
58 %(test)s
58 %(test)s
General Comments 0
You need to be logged in to leave comments. Login now