Add session based log disable at test

This commit is contained in:
shortcutme 2019-12-04 12:46:44 +01:00
parent ea5f64bfea
commit 1935a69c04
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -419,9 +419,8 @@ def logCaseStart(request):
yield None # Wait until all test done yield None # Wait until all test done
# Workaround for pytest bug when logging in atexit/post-fixture handlers (I/O operation on closed file)
def workaroundPytestLogError(): def workaroundPytestLogError():
# Workaround for pytest bug when logging in atexit/post-fixture handlers (I/O operation on closed file)
import _pytest.capture import _pytest.capture
write_original = _pytest.capture.EncodedFile.write write_original = _pytest.capture.EncodedFile.write
@ -449,9 +448,8 @@ def workaroundPytestLogError():
workaroundPytestLogError() workaroundPytestLogError()
@pytest.fixture(scope='function', autouse=True) @pytest.fixture(scope='session', autouse=True)
def logCaseStart(request): def disableLog():
logging.debug("---- Start test case: %s ----" % request._pyfuncitem)
yield None # Wait until all test done yield None # Wait until all test done
logging.getLogger('').setLevel(logging.getLevelName(logging.CRITICAL)) logging.getLogger('').setLevel(logging.getLevelName(logging.CRITICAL))