ipatests: Remove no longer needed 'capture' compatibility

Since the required Pytest is 3.9.1+, old Pytest compat code can
be removed.

Fixes: https://pagure.io/freeipa/issue/8101
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Sergey Orlov <sorlov@redhat.com>
This commit is contained in:
Stanislav Levin 2020-04-13 19:40:17 +03:00 committed by Sergey Orlov
parent be6ac7d4c9
commit f6b088effd
No known key found for this signature in database
GPG Key ID: ADF8C90EDD04503D

View File

@ -54,19 +54,11 @@ def pytest_configure(config):
capture = config.pluginmanager.getplugin('capturemanager')
orig_stdout, orig_stderr = sys.stdout, sys.stderr
if capture:
if hasattr(capture, 'suspend_global_capture'):
# pytest >= 3.3
capture.suspend_global_capture()
else:
# legacy support for pytest <= 3.2 (Fedora 27)
capture._capturing.suspend_capturing()
capture.suspend_global_capture()
sys.stderr.write(self.format(record))
sys.stderr.write('\n')
if capture:
if hasattr(capture, 'resume_global_capture'):
capture.resume_global_capture()
else:
capture._capturing.resume_capturing()
capture.resume_global_capture()
sys.stdout, sys.stderr = orig_stdout, orig_stderr
level = convert_log_level(config.getoption('logging_level'))