From 1935a69c04ac41e18775a33e6f1e511ecbf532f2 Mon Sep 17 00:00:00 2001 From: shortcutme <tamas@zeronet.io> Date: Wed, 4 Dec 2019 12:46:44 +0100 Subject: [PATCH] Add session based log disable at test --- src/Test/conftest.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Test/conftest.py b/src/Test/conftest.py index 4ec4354d..74f27712 100644 --- a/src/Test/conftest.py +++ b/src/Test/conftest.py @@ -419,9 +419,8 @@ def logCaseStart(request): 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(): - # Workaround for pytest bug when logging in atexit/post-fixture handlers (I/O operation on closed file) - import _pytest.capture write_original = _pytest.capture.EncodedFile.write @@ -449,9 +448,8 @@ def workaroundPytestLogError(): workaroundPytestLogError() -@pytest.fixture(scope='function', autouse=True) -def logCaseStart(request): - logging.debug("---- Start test case: %s ----" % request._pyfuncitem) +@pytest.fixture(scope='session', autouse=True) +def disableLog(): yield None # Wait until all test done logging.getLogger('').setLevel(logging.getLevelName(logging.CRITICAL))