From 8b2c91836b507727141b12b1f47c8d29ef744d1e Mon Sep 17 00:00:00 2001 From: victor Date: Sun, 19 Aug 2018 14:30:50 +0200 Subject: [PATCH] Fixed activation and used just runtest_protocol hook --- src/_pytest/capture.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index f10a13a1f..658632e00 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -193,12 +193,10 @@ class CaptureManager(object): yield @pytest.hookimpl(hookwrapper=True) - def pytest_runtest_logstart(self, item): - self._current_item = item - - @pytest.hookimpl(hookwrapper=True) - def pytest_runtest_logfinish(self, item): + def pytest_runtest_protocol(self, item): self._current_item = item + yield + self._current_item = None @pytest.hookimpl(hookwrapper=True) def pytest_runtest_setup(self, item): @@ -329,7 +327,7 @@ class CaptureFixture(object): def _start(self): # Start if not started yet - if getattr(self, "_capture", None) is not None: + if getattr(self, "_capture", None) is None: self._capture = MultiCapture( out=True, err=True, in_=False, Capture=self.captureclass )