Show More
@@ -65,7 +65,7 b' jobs:' | |||||
65 | run: | |
|
65 | run: | | |
66 | python -m pip install --only-binary ':all:' --upgrade pip setuptools wheel build |
|
66 | python -m pip install --only-binary ':all:' --upgrade pip setuptools wheel build | |
67 | python -m pip install --only-binary ':all:' --no-binary curio --upgrade -e .[${{ matrix.deps }}] |
|
67 | python -m pip install --only-binary ':all:' --no-binary curio --upgrade -e .[${{ matrix.deps }}] | |
68 | python -m pip install --only-binary ':all:' --upgrade check-manifest pytest-cov pytest-json-report |
|
68 | python -m pip install --only-binary ':all:' --upgrade check-manifest pytest-cov pytest-json-report 'pytest<8' | |
69 | - name: Install and update Python dependencies (dev?) |
|
69 | - name: Install and update Python dependencies (dev?) | |
70 | if: ${{ contains( matrix.python-version, 'dev' ) }} |
|
70 | if: ${{ contains( matrix.python-version, 'dev' ) }} | |
71 | run: | |
|
71 | run: | | |
@@ -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 |
@@ -36,6 +36,7 b' Authors' | |||||
36 |
|
36 | |||
37 | # Stdlib |
|
37 | # Stdlib | |
38 | import re |
|
38 | import re | |
|
39 | import sys | |||
39 | import unittest |
|
40 | import unittest | |
40 | from doctest import DocTestFinder, DocTestRunner, TestResults |
|
41 | from doctest import DocTestFinder, DocTestRunner, TestResults | |
41 | from IPython.terminal.interactiveshell import InteractiveShell |
|
42 | from IPython.terminal.interactiveshell import InteractiveShell | |
@@ -49,7 +50,14 b' def count_failures(runner):' | |||||
49 |
|
50 | |||
50 | Code modeled after the summarize() method in doctest. |
|
51 | Code modeled after the summarize() method in doctest. | |
51 | """ |
|
52 | """ | |
52 | return [TestResults(f, t) for f, t in runner._name2ft.values() if f > 0 ] |
|
53 | if sys.version_info < (3, 13): | |
|
54 | return [TestResults(f, t) for f, t in runner._name2ft.values() if f > 0] | |||
|
55 | else: | |||
|
56 | return [ | |||
|
57 | TestResults(failure, try_) | |||
|
58 | for failure, try_, skip in runner._stats.values() | |||
|
59 | if failure > 0 | |||
|
60 | ] | |||
53 |
|
61 | |||
54 |
|
62 | |||
55 | class IPython2PythonConverter(object): |
|
63 | class IPython2PythonConverter(object): |
@@ -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 |
|
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 |
@@ -9,6 +9,7 b' import sys' | |||||
9 | # Our own |
|
9 | # Our own | |
10 | from IPython.testing import decorators as dec |
|
10 | from IPython.testing import decorators as dec | |
11 | from IPython.testing.skipdoctest import skip_doctest |
|
11 | from IPython.testing.skipdoctest import skip_doctest | |
|
12 | from IPython.utils.text import dedent | |||
12 |
|
13 | |||
13 | #----------------------------------------------------------------------------- |
|
14 | #----------------------------------------------------------------------------- | |
14 | # Utilities |
|
15 | # Utilities | |
@@ -89,10 +90,11 b' def test_skip_dt_decorator():' | |||||
89 | >>> 1+1 |
|
90 | >>> 1+1 | |
90 | 3 |
|
91 | 3 | |
91 | """ |
|
92 | """ | |
|
93 | ||||
92 | # Fetch the docstring from doctest_bad after decoration. |
|
94 | # Fetch the docstring from doctest_bad after decoration. | |
93 | val = doctest_bad.__doc__ |
|
95 | val = doctest_bad.__doc__ | |
94 |
|
96 | |||
95 | assert check == val, "doctest_bad docstrings don't match" |
|
97 | assert dedent(check) == dedent(val), "doctest_bad docstrings don't match" | |
96 |
|
98 | |||
97 |
|
99 | |||
98 | # Doctest skipping should work for class methods too |
|
100 | # Doctest skipping should work for class methods too |
@@ -52,7 +52,6 b' doc =' | |||||
52 | docrepr |
|
52 | docrepr | |
53 | matplotlib |
|
53 | matplotlib | |
54 | stack_data |
|
54 | stack_data | |
55 | pytest |
|
|||
56 | typing_extensions |
|
55 | typing_extensions | |
57 | exceptiongroup |
|
56 | exceptiongroup | |
58 | %(test)s |
|
57 | %(test)s | |
@@ -71,7 +70,7 b' qtconsole =' | |||||
71 | qtconsole |
|
70 | qtconsole | |
72 | terminal = |
|
71 | terminal = | |
73 | test = |
|
72 | test = | |
74 | pytest |
|
73 | pytest<8 | |
75 | pytest-asyncio<0.22 |
|
74 | pytest-asyncio<0.22 | |
76 | testpath |
|
75 | testpath | |
77 | pickleshare |
|
76 | pickleshare |
General Comments 0
You need to be logged in to leave comments.
Login now