Skip to content

Commit f617bab

Browse files
committed
Update pre-commit config
1 parent f4e3b4a commit f617bab

File tree

6 files changed

+21
-32
lines changed

6 files changed

+21
-32
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ repos:
4040
rev: v3.10.0
4141
hooks:
4242
- id: reorder-python-imports
43-
args: ['--application-directories=.:src', --py37-plus]
43+
args: ['--application-directories=.:src', --py38-plus]
4444
- repo: https://github.com/asottile/pyupgrade
4545
rev: v3.7.0
4646
hooks:
4747
- id: pyupgrade
48-
args: [--py37-plus]
48+
args: [--py38-plus]
4949
- repo: https://github.com/asottile/setup-cfg-fmt
5050
rev: v2.3.0
5151
hooks:

src/_pytest/_code/code.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@
1717
from typing import Callable
1818
from typing import ClassVar
1919
from typing import Dict
20+
from typing import Final
2021
from typing import final
2122
from typing import Generic
2223
from typing import Iterable
2324
from typing import List
25+
from typing import Literal
2426
from typing import Mapping
2527
from typing import Optional
2628
from typing import overload
2729
from typing import Pattern
2830
from typing import Sequence
2931
from typing import Set
32+
from typing import SupportsIndex
3033
from typing import Tuple
3134
from typing import Type
32-
from typing import TYPE_CHECKING
3335
from typing import TypeVar
3436
from typing import Union
3537

@@ -48,16 +50,11 @@
4850
from _pytest.pathlib import absolutepath
4951
from _pytest.pathlib import bestrelpath
5052

51-
if TYPE_CHECKING:
52-
from typing_extensions import Final
53-
from typing_extensions import Literal
54-
from typing_extensions import SupportsIndex
55-
56-
_TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"]
57-
5853
if sys.version_info[:2] < (3, 11):
5954
from exceptiongroup import BaseExceptionGroup
6055

56+
_TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"]
57+
6158

6259
class Code:
6360
"""Wrapper around Python code objects."""
@@ -633,7 +630,7 @@ def _getreprcrash(self) -> Optional["ReprFileLocation"]:
633630
def getrepr(
634631
self,
635632
showlocals: bool = False,
636-
style: "_TracebackStyle" = "long",
633+
style: _TracebackStyle = "long",
637634
abspath: bool = False,
638635
tbfilter: Union[
639636
bool, Callable[["ExceptionInfo[BaseException]"], Traceback]
@@ -725,7 +722,7 @@ class FormattedExcinfo:
725722
fail_marker: ClassVar = "E"
726723

727724
showlocals: bool = False
728-
style: "_TracebackStyle" = "long"
725+
style: _TracebackStyle = "long"
729726
abspath: bool = True
730727
tbfilter: Union[bool, Callable[[ExceptionInfo[BaseException]], Traceback]] = True
731728
funcargs: bool = False
@@ -1090,7 +1087,7 @@ def toterminal(self, tw: TerminalWriter) -> None:
10901087
class ReprTraceback(TerminalRepr):
10911088
reprentries: Sequence[Union["ReprEntry", "ReprEntryNative"]]
10921089
extraline: Optional[str]
1093-
style: "_TracebackStyle"
1090+
style: _TracebackStyle
10941091

10951092
entrysep: ClassVar = "_ "
10961093

@@ -1124,7 +1121,7 @@ def __init__(self, tblines: Sequence[str]) -> None:
11241121
class ReprEntryNative(TerminalRepr):
11251122
lines: Sequence[str]
11261123

1127-
style: ClassVar["_TracebackStyle"] = "native"
1124+
style: ClassVar[_TracebackStyle] = "native"
11281125

11291126
def toterminal(self, tw: TerminalWriter) -> None:
11301127
tw.write("".join(self.lines))
@@ -1136,7 +1133,7 @@ class ReprEntry(TerminalRepr):
11361133
reprfuncargs: Optional["ReprFuncArgs"]
11371134
reprlocals: Optional["ReprLocals"]
11381135
reprfileloc: Optional["ReprFileLocation"]
1139-
style: "_TracebackStyle"
1136+
style: _TracebackStyle
11401137

11411138
def _write_entry_lines(self, tw: TerminalWriter) -> None:
11421139
"""Write the source code portions of a list of traceback entries with syntax highlighting.

src/_pytest/capture.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
from typing import Any
1212
from typing import AnyStr
1313
from typing import BinaryIO
14+
from typing import Final
1415
from typing import final
1516
from typing import Generator
1617
from typing import Generic
1718
from typing import Iterable
1819
from typing import Iterator
1920
from typing import List
21+
from typing import Literal
2022
from typing import NamedTuple
2123
from typing import Optional
2224
from typing import TextIO
@@ -35,11 +37,7 @@
3537
from _pytest.nodes import File
3638
from _pytest.nodes import Item
3739

38-
if TYPE_CHECKING:
39-
from typing_extensions import Final
40-
from typing_extensions import Literal
41-
42-
_CaptureMethod = Literal["fd", "sys", "no", "tee-sys"]
40+
_CaptureMethod = Literal["fd", "sys", "no", "tee-sys"]
4341

4442

4543
def pytest_addoption(parser: Parser) -> None:
@@ -687,7 +685,7 @@ def readouterr(self) -> CaptureResult[AnyStr]:
687685
return CaptureResult(out, err) # type: ignore[arg-type]
688686

689687

690-
def _get_multicapture(method: "_CaptureMethod") -> MultiCapture[str]:
688+
def _get_multicapture(method: _CaptureMethod) -> MultiCapture[str]:
691689
if method == "fd":
692690
return MultiCapture(in_=FDCapture(0), out=FDCapture(1), err=FDCapture(2))
693691
elif method == "sys":
@@ -723,7 +721,7 @@ class CaptureManager:
723721
needed to ensure the fixtures take precedence over the global capture.
724722
"""
725723

726-
def __init__(self, method: "_CaptureMethod") -> None:
724+
def __init__(self, method: _CaptureMethod) -> None:
727725
self._method: Final = method
728726
self._global_capturing: Optional[MultiCapture[str]] = None
729727
self._capture_fixture: Optional[CaptureFixture[Any]] = None

src/_pytest/compat.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@
1212
from pathlib import Path
1313
from typing import Any
1414
from typing import Callable
15+
from typing import Final
1516
from typing import NoReturn
16-
from typing import TYPE_CHECKING
1717
from typing import TypeVar
1818

1919
import py
2020

21-
if TYPE_CHECKING:
22-
from typing_extensions import Final
23-
2421

2522
_T = TypeVar("_T")
2623
_S = TypeVar("_S")

src/_pytest/legacypath.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import shlex
44
import subprocess
55
from pathlib import Path
6+
from typing import Final
67
from typing import final
78
from typing import List
89
from typing import Optional
@@ -32,8 +33,6 @@
3233
from _pytest.tmpdir import TempPathFactory
3334

3435
if TYPE_CHECKING:
35-
from typing_extensions import Final
36-
3736
import pexpect
3837

3938

src/_pytest/pytester.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@
2020
from typing import Any
2121
from typing import Callable
2222
from typing import Dict
23+
from typing import Final
2324
from typing import final
2425
from typing import Generator
2526
from typing import IO
2627
from typing import Iterable
2728
from typing import List
29+
from typing import Literal
2830
from typing import Optional
2931
from typing import overload
3032
from typing import Sequence
@@ -68,11 +70,7 @@
6870
from _pytest.tmpdir import TempPathFactory
6971
from _pytest.warning_types import PytestWarning
7072

71-
7273
if TYPE_CHECKING:
73-
from typing_extensions import Final
74-
from typing_extensions import Literal
75-
7674
import pexpect
7775

7876

0 commit comments

Comments
 (0)