If you run py.test --cov libtaskotron testing/ against libtaskotron, it currently fails with:
=============================================================== FAILURES =============================================================== ______ TestLogger.testmemhandler_to_logfile_level ________
self = , tmpdir = local('/tmp/pytest-31/test_memhandler_to_logfile_lev1')
def test_memhandler_to_logfile_level(self, tmpdir): '''When forwarding messages from memory to file, only messages with appropriate levels should be passed over''' log_path = tmpdir.join('test.log').strpath logger.init_prior_config() # include random strings in the message for better reliability msg1 = 'A debug message Xai(Deihee8a' logger.log.debug(msg1) msg2 = 'An info message aC2pu}i5chai' logger.log.info(msg2) msg3 = 'A warn message lai_choow5Ie' logger.log.warn(msg3) logger.init() fh = logger.add_filehandler(filelog_path=log_path, level_file=logging.WARN) fh.flush() with open(log_path) as log_file: lines = log_file.readlines() # msg1 nor msg2 should not be there, msg3 should be there assert len([line for line in lines if msg1 in line]) == 0 assert len([line for line in lines if msg2 in line]) == 0
assert len([line for line in lines if msg3 in line]) == 1 E assert 2 == 1 E + where 2 = len(['[libtaskotron:functest_logger.py:75] 2016-03-09 22:02:27 WARNING A warn message lai_choow5Ie\n', '[libtaskotron:functest_logger.py:75] 2016-03-09 22:02:42 WARNING A warn message lai_choow5Ie\n'])
assert len([line for line in lines if msg3 in line]) == 1
E assert 2 == 1 E + where 2 = len(['[libtaskotron:functest_logger.py:75] 2016-03-09 22:02:27 WARNING A warn message lai_choow5Ie\n', '[libtaskotron:functest_logger.py:75] 2016-03-09 22:02:42 WARNING A warn message lai_choow5Ie\n'])
testing/functest_logger.py:87: AssertionError
This is because this particular test winds up running twice; however, the log file is not cleared out between runs, so it winds up with duplicate entries. That, in turn, winds up causing this line of code to error out:
(from testing/functest_logger.py line 87)
This ticket had assigned some Differential requests: D774
Fixed in D774.