Skip to content

Commit bbe6b4a

Browse files
Merge pull request #12467 from RonnyPfannschmidt/ronny/new-annotations-try-2
from __future__ import annotations + migrate
2 parents 2f92da9 + 6a8e9ed commit bbe6b4a

File tree

244 files changed

+2016
-1805
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+2016
-1805
lines changed

bench/bench.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import sys
24

35

bench/bench_argcomplete.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# 2.7.5 3.3.2
33
# FilesCompleter 75.1109 69.2116
44
# FastFilesCompleter 0.7383 1.0760
5+
from __future__ import annotations
6+
57
import timeit
68

79

bench/empty.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
from __future__ import annotations
2+
3+
14
for i in range(1000):
25
exec("def test_func_%d(): pass" % i)

bench/manyparam.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import pytest
24

35

bench/skip.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import pytest
24

35

bench/unit_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from unittest import TestCase # noqa: F401
24

35

bench/xunit.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from __future__ import annotations
2+
3+
14
for i in range(5000):
25
exec(
36
f"""

changelog/12467.improvement.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Migrated all internal type-annotations to the python3.10+ style by using the `annotations` future import.
2+
3+
-- by :user:`RonnyPfannschmidt`

doc/en/conf.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@
1515
#
1616
# The full version, including alpha/beta/rc tags.
1717
# The short X.Y version.
18+
from __future__ import annotations
19+
1820
import os
1921
from pathlib import Path
2022
import shutil
2123
from textwrap import dedent
2224
from typing import TYPE_CHECKING
2325

24-
from _pytest import __version__ as version
26+
from _pytest import __version__ as full_version
27+
2528

29+
version = full_version.split("+")[0]
2630

2731
if TYPE_CHECKING:
2832
import sphinx.application
@@ -189,6 +193,7 @@
189193
("py:class", "SubRequest"),
190194
("py:class", "TerminalReporter"),
191195
("py:class", "_pytest._code.code.TerminalRepr"),
196+
("py:class", "TerminalRepr"),
192197
("py:class", "_pytest.fixtures.FixtureFunctionMarker"),
193198
("py:class", "_pytest.logging.LogCaptureHandler"),
194199
("py:class", "_pytest.mark.structures.ParameterSet"),
@@ -210,13 +215,16 @@
210215
("py:class", "_PluggyPlugin"),
211216
# TypeVars
212217
("py:class", "_pytest._code.code.E"),
218+
("py:class", "E"), # due to delayed annotation
213219
("py:class", "_pytest.fixtures.FixtureFunction"),
214220
("py:class", "_pytest.nodes._NodeType"),
221+
("py:class", "_NodeType"), # due to delayed annotation
215222
("py:class", "_pytest.python_api.E"),
216223
("py:class", "_pytest.recwarn.T"),
217224
("py:class", "_pytest.runner.TResult"),
218225
("py:obj", "_pytest.fixtures.FixtureValue"),
219226
("py:obj", "_pytest.stash.T"),
227+
("py:class", "_ScopeName"),
220228
]
221229

222230

@@ -455,7 +463,7 @@
455463
}
456464

457465

458-
def setup(app: "sphinx.application.Sphinx") -> None:
466+
def setup(app: sphinx.application.Sphinx) -> None:
459467
app.add_crossref_type(
460468
"fixture",
461469
"fixture",

doc/en/conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
from __future__ import annotations
2+
3+
14
collect_ignore = ["conf.py"]

0 commit comments

Comments
 (0)