File tree 15 files changed +76
-16
lines changed 15 files changed +76
-16
lines changed Original file line number Diff line number Diff line change 20
20
21
21
from _pytest import __version__ as version
22
22
23
- if False : # TYPE_CHECKING
23
+ try :
24
+ from typing import TYPE_CHECKING
25
+ except ImportError :
26
+ from typing_extensions import TYPE_CHECKING
27
+ if TYPE_CHECKING :
24
28
import sphinx .application
25
29
26
30
Original file line number Diff line number Diff line change 33
33
from _pytest ._io .saferepr import saferepr
34
34
from _pytest .compat import overload
35
35
36
- if False : # TYPE_CHECKING
36
+ try :
37
+ from typing import TYPE_CHECKING
38
+ except ImportError :
39
+ from typing_extensions import TYPE_CHECKING
40
+ if TYPE_CHECKING :
37
41
from typing import Type
38
42
from typing_extensions import Literal
39
43
from weakref import ReferenceType # noqa: F401
Original file line number Diff line number Diff line change 28
28
from _pytest .outcomes import fail
29
29
from _pytest .outcomes import TEST_OUTCOME
30
30
31
- if False : # TYPE_CHECKING
31
+ try :
32
+ from typing import TYPE_CHECKING
33
+ except ImportError :
34
+ from typing_extensions import TYPE_CHECKING
35
+ if TYPE_CHECKING :
32
36
from typing import Type # noqa: F401 (used in type string)
33
37
34
38
Original file line number Diff line number Diff line change 42
42
from _pytest .pathlib import Path
43
43
from _pytest .warning_types import PytestConfigWarning
44
44
45
- if False : # TYPE_CHECKING
45
+ try :
46
+ from typing import TYPE_CHECKING
47
+ except ImportError :
48
+ from typing_extensions import TYPE_CHECKING
49
+ if TYPE_CHECKING :
46
50
from typing import Type
47
51
48
52
from .argparsing import Argument
Original file line number Diff line number Diff line change 17
17
18
18
from _pytest .config .exceptions import UsageError
19
19
20
- if False : # TYPE_CHECKING
20
+ try :
21
+ from typing import TYPE_CHECKING
22
+ except ImportError :
23
+ from typing_extensions import TYPE_CHECKING
24
+ if TYPE_CHECKING :
21
25
from typing import NoReturn
22
26
from typing_extensions import Literal # noqa: F401
23
27
Original file line number Diff line number Diff line change 7
7
from .exceptions import UsageError
8
8
from _pytest .outcomes import fail
9
9
10
- if False :
10
+ try :
11
+ from typing import TYPE_CHECKING
12
+ except ImportError :
13
+ from typing_extensions import TYPE_CHECKING
14
+ if TYPE_CHECKING :
11
15
from . import Config # noqa: F401
12
16
13
17
Original file line number Diff line number Diff line change 24
24
from _pytest .python_api import approx
25
25
from _pytest .warning_types import PytestWarning
26
26
27
- if False : # TYPE_CHECKING
27
+ try :
28
+ from typing import TYPE_CHECKING
29
+ except ImportError :
30
+ from typing_extensions import TYPE_CHECKING
31
+ if TYPE_CHECKING :
28
32
import doctest
29
33
from typing import Type
30
34
Original file line number Diff line number Diff line change 32
32
from _pytest .outcomes import fail
33
33
from _pytest .outcomes import TEST_OUTCOME
34
34
35
- if False : # TYPE_CHECKING
35
+ try :
36
+ from typing import TYPE_CHECKING
37
+ except ImportError :
38
+ from typing_extensions import TYPE_CHECKING
39
+ if TYPE_CHECKING :
36
40
from typing import Type
37
41
38
42
from _pytest import nodes
Original file line number Diff line number Diff line change 27
27
from _pytest .mark .structures import NodeKeywords
28
28
from _pytest .outcomes import Failed
29
29
30
- if False : # TYPE_CHECKING
30
+ try :
31
+ from typing import TYPE_CHECKING
32
+ except ImportError :
33
+ from typing_extensions import TYPE_CHECKING
34
+ if TYPE_CHECKING :
31
35
# Imported here due to circular import.
32
36
from _pytest .main import Session # noqa: F401
33
37
Original file line number Diff line number Diff line change 8
8
9
9
from packaging .version import Version
10
10
11
- if False : # TYPE_CHECKING
11
+ try :
12
+ from typing import TYPE_CHECKING
13
+ except ImportError :
14
+ from typing_extensions import TYPE_CHECKING
15
+ if TYPE_CHECKING :
12
16
from typing import NoReturn
13
17
14
18
Original file line number Diff line number Diff line change 35
35
from _pytest .pathlib import Path
36
36
from _pytest .reports import TestReport
37
37
38
- if False : # TYPE_CHECKING
38
+ try :
39
+ from typing import TYPE_CHECKING
40
+ except ImportError :
41
+ from typing_extensions import TYPE_CHECKING
42
+ if TYPE_CHECKING :
39
43
from typing import Type
40
44
41
45
@@ -189,7 +193,7 @@ def __repr__(self):
189
193
del d ["_name" ]
190
194
return "<ParsedCall {!r}(**{!r})>" .format (self ._name , d )
191
195
192
- if False : # TYPE_CHECKING
196
+ if TYPE_CHECKING :
193
197
# The class has undetermined attributes, this tells mypy about it.
194
198
def __getattr__ (self , key ):
195
199
raise NotImplementedError ()
Original file line number Diff line number Diff line change 25
25
from _pytest .compat import STRING_TYPES
26
26
from _pytest .outcomes import fail
27
27
28
- if False : # TYPE_CHECKING
28
+ try :
29
+ from typing import TYPE_CHECKING
30
+ except ImportError :
31
+ from typing_extensions import TYPE_CHECKING
32
+ if TYPE_CHECKING :
29
33
from typing import Type # noqa: F401 (used in type string)
30
34
31
35
Original file line number Diff line number Diff line change 15
15
from _pytest .fixtures import yield_fixture
16
16
from _pytest .outcomes import fail
17
17
18
- if False : # TYPE_CHECKING
18
+ try :
19
+ from typing import TYPE_CHECKING
20
+ except ImportError :
21
+ from typing_extensions import TYPE_CHECKING
22
+ if TYPE_CHECKING :
19
23
from typing import Type
20
24
21
25
Original file line number Diff line number Diff line change 20
20
from _pytest .outcomes import Skipped
21
21
from _pytest .outcomes import TEST_OUTCOME
22
22
23
- if False : # TYPE_CHECKING
23
+ try :
24
+ from typing import TYPE_CHECKING
25
+ except ImportError :
26
+ from typing_extensions import TYPE_CHECKING
27
+ if TYPE_CHECKING :
24
28
from typing import Type
25
29
26
30
#
Original file line number Diff line number Diff line change 5
5
import attr
6
6
7
7
8
- if False : # TYPE_CHECKING
8
+ try :
9
+ from typing import TYPE_CHECKING
10
+ except ImportError :
11
+ from typing_extensions import TYPE_CHECKING
12
+ if TYPE_CHECKING :
9
13
from typing import Type # noqa: F401 (used in type string)
10
14
11
15
You can’t perform that action at this time.
0 commit comments