(self, method)
| 63 | class TestCaptureManager: |
| 64 | @pytest.mark.parametrize("method", ["no", "sys", "fd"]) |
| 65 | def test_capturing_basic_api(self, method) -> None: |
| 66 | capouter = StdCaptureFD() |
| 67 | old = sys.stdout, sys.stderr, sys.stdin |
| 68 | try: |
| 69 | capman = CaptureManager(method) |
| 70 | capman.start_global_capturing() |
| 71 | capman.suspend_global_capture() |
| 72 | outerr = capman.read_global_capture() |
| 73 | assert outerr == ("", "") |
| 74 | capman.suspend_global_capture() |
| 75 | outerr = capman.read_global_capture() |
| 76 | assert outerr == ("", "") |
| 77 | print("hello") |
| 78 | capman.suspend_global_capture() |
| 79 | out, _err = capman.read_global_capture() |
| 80 | if method == "no": |
| 81 | assert old == (sys.stdout, sys.stderr, sys.stdin) |
| 82 | else: |
| 83 | assert not out |
| 84 | capman.resume_global_capture() |
| 85 | print("hello") |
| 86 | capman.suspend_global_capture() |
| 87 | out, _err = capman.read_global_capture() |
| 88 | if method != "no": |
| 89 | assert out == "hello\n" |
| 90 | capman.stop_global_capturing() |
| 91 | finally: |
| 92 | capouter.stop_capturing() |
| 93 | |
| 94 | def test_init_capturing(self): |
| 95 | capouter = StdCaptureFD() |
nothing calls this directly
no test coverage detected