From ed88e5e9abb8c24cee2507b62a45878637411c25 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Thu, 18 May 2017 19:37:26 +0200 Subject: Modify how to disable logging in unit test. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Logs are only disabled when the unit tests are run from cmdline. It allows running them via pytest_suite_runner.py and printing their results to functest.log. You should notice that the unit test must disable the logger of the tested TestCase (e.g. testcase.TestCase.logger.disabled = 1). Otherwise false logs will be printed in console. Change-Id: Ic171e4575c8bab2e52db1897ae026b61a03b6247 Signed-off-by: Cédric Ollivier --- .../unit/openstack/refstack_client/test_refstack_client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'functest/tests/unit/openstack/refstack_client') diff --git a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py index 60e180c9..58ec5a07 100644 --- a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py +++ b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py @@ -17,11 +17,10 @@ from functest.utils.constants import CONST class OSRefstackClientTesting(unittest.TestCase): - logging.disable(logging.CRITICAL) - _config = \ - os.path.join(CONST.dir_functest_test, CONST.refstack_tempest_conf_path) - _testlist = \ - os.path.join(CONST.dir_functest_test, CONST.refstack_defcore_list) + _config = os.path.join(CONST.dir_functest_test, + CONST.refstack_tempest_conf_path) + _testlist = os.path.join(CONST.dir_functest_test, + CONST.refstack_defcore_list) def setUp(self): self.defaultargs = {'config': self._config, @@ -101,4 +100,5 @@ class OSRefstackClientTesting(unittest.TestCase): if __name__ == "__main__": + logging.disable(logging.CRITICAL) unittest.main(verbosity=2) -- cgit 1.2.3-korg