File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 1717import pytest
1818from _pytest .compat import CaptureAndPassthroughIO
1919from _pytest .compat import CaptureIO
20+ from _pytest .compat import TYPE_CHECKING
2021from _pytest .config import Config
2122from _pytest .fixtures import FixtureRequest
2223
24+ if TYPE_CHECKING :
25+ from typing_extensions import Literal
26+
27+ _CaptureMethod = Literal ["fd" , "sys" , "no" , "tee-sys" ]
28+
2329patchsysdict = {0 : "stdin" , 1 : "stdout" , 2 : "stderr" }
2430
2531
@@ -66,7 +72,7 @@ def pytest_load_initial_conftests(early_config: Config):
6672 sys .stderr .write (err )
6773
6874
69- def _get_multicapture (method : str ) -> "MultiCapture" :
75+ def _get_multicapture (method : "_CaptureMethod" ) -> "MultiCapture" :
7076 if method == "fd" :
7177 return MultiCapture (out = True , err = True , Capture = FDCapture )
7278 elif method == "sys" :
@@ -91,7 +97,7 @@ class CaptureManager:
9197 case special handling is needed to ensure the fixtures take precedence over the global capture.
9298 """
9399
94- def __init__ (self , method ) -> None :
100+ def __init__ (self , method : "_CaptureMethod" ) -> None :
95101 self ._method = method
96102 self ._global_capturing = None
97103 self ._capture_fixture = None # type: Optional[CaptureFixture]
You can’t perform that action at this time.
0 commit comments