1717from typing import Callable
1818from typing import ClassVar
1919from typing import Dict
20+ from typing import Final
2021from typing import final
2122from typing import Generic
2223from typing import Iterable
2324from typing import List
25+ from typing import Literal
2426from typing import Mapping
2527from typing import Optional
2628from typing import overload
2729from typing import Pattern
2830from typing import Sequence
2931from typing import Set
32+ from typing import SupportsIndex
3033from typing import Tuple
3134from typing import Type
32- from typing import TYPE_CHECKING
3335from typing import TypeVar
3436from typing import Union
3537
4850from _pytest .pathlib import absolutepath
4951from _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-
5853if sys .version_info [:2 ] < (3 , 11 ):
5954 from exceptiongroup import BaseExceptionGroup
6055
56+ _TracebackStyle = Literal ["long" , "short" , "line" , "no" , "native" , "value" , "auto" ]
57+
6158
6259class 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:
10901087class 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:
11241121class 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.
0 commit comments