From 46d2bb04ef995f5ef2289fbdf1313f1804b2a427 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Fri, 2 Jun 2023 20:11:27 -0700 Subject: [PATCH] suspend default capture plugin while capturing --- pytest_output_to_files.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pytest_output_to_files.py b/pytest_output_to_files.py index 91a8937..82e8484 100644 --- a/pytest_output_to_files.py +++ b/pytest_output_to_files.py @@ -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): -- 2.30.2