File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 17
17
import pytest
18
18
from _pytest .compat import CaptureAndPassthroughIO
19
19
from _pytest .compat import CaptureIO
20
+ from _pytest .compat import TYPE_CHECKING
20
21
from _pytest .config import Config
21
22
from _pytest .fixtures import FixtureRequest
22
23
24
+ if TYPE_CHECKING :
25
+ from typing_extensions import Literal
26
+
27
+ _CaptureMethod = Literal ["fd" , "sys" , "no" , "tee-sys" ]
28
+
23
29
patchsysdict = {0 : "stdin" , 1 : "stdout" , 2 : "stderr" }
24
30
25
31
@@ -66,7 +72,7 @@ def pytest_load_initial_conftests(early_config: Config):
66
72
sys .stderr .write (err )
67
73
68
74
69
- def _get_multicapture (method : str ) -> "MultiCapture" :
75
+ def _get_multicapture (method : "_CaptureMethod" ) -> "MultiCapture" :
70
76
if method == "fd" :
71
77
return MultiCapture (out = True , err = True , Capture = FDCapture )
72
78
elif method == "sys" :
@@ -91,7 +97,7 @@ class CaptureManager:
91
97
case special handling is needed to ensure the fixtures take precedence over the global capture.
92
98
"""
93
99
94
- def __init__ (self , method ) -> None :
100
+ def __init__ (self , method : "_CaptureMethod" ) -> None :
95
101
self ._method = method
96
102
self ._global_capturing = None
97
103
self ._capture_fixture = None # type: Optional[CaptureFixture]
You can’t perform that action at this time.
0 commit comments