suspend default capture plugin while capturing
authorJacob Lifshay <programmerjake@gmail.com>
Sat, 3 Jun 2023 03:11:27 +0000 (20:11 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Sat, 3 Jun 2023 03:11:27 +0000 (20:11 -0700)
pytest_output_to_files.py

index 91a893749ea5dceeda82ccaba4e193b2e4861f5e..82e848451c83e4dc53f186664e37901cad610779 100644 (file)
@@ -242,12 +242,17 @@ class _OutputToFilesPlugin:
     @contextlib.contextmanager
     def __capture_item(self, item, when):
         # type: (pytest.Item, str) -> Generator[Any, Any, Any]
+        builtin_capman = item.config.pluginmanager.getplugin("capturemanager")
+        if builtin_capman is not None:
+            builtin_capman.suspend_global_capture()
         try:
             self.__start(item, when)
             yield
             self.__stop(item, when)
         finally:
             self.__abort()
+            if builtin_capman is not None:
+                builtin_capman.resume_global_capture()
 
     @pytest.hookimpl(tryfirst=True)
     def pytest_keyboard_interrupt(self, excinfo):