From 0b98c48cbe28a01e325d4877ab76395db6548461 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Thu, 26 Mar 2015 16:47:20 +0100 Subject: gbplogtester: add helper to test for empty log --- tests/18_test_Config.py | 4 ++-- tests/testutils/gbplogtester.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/18_test_Config.py b/tests/18_test_Config.py index d3d9461..ea905cc 100644 --- a/tests/18_test_Config.py +++ b/tests/18_test_Config.py @@ -38,8 +38,8 @@ class TestConfigParser(unittest.TestCase, GbpLogTester): for prefix in [ '', 'git-', 'gbp-' ]: parser = GbpOptionParser('%scmd1' % prefix) self.assertEqual(parser.config['single_override_option1'], 'single_override_value1') - # No deprecation warning since we test1.conf section is [cmd1] - self.assertEqual(self._get_log(), []) + # No deprecation warning since the test1.conf section is [cmd1] + self._check_log_empty() def test_single_git_override(self): """ diff --git a/tests/testutils/gbplogtester.py b/tests/testutils/gbplogtester.py index 2f2f43e..9a54f02 100644 --- a/tests/testutils/gbplogtester.py +++ b/tests/testutils/gbplogtester.py @@ -37,6 +37,11 @@ class GbpLogTester(object): self._log.seek(0) return self._log.readlines() + def _check_log_empty(self): + """Check that nothig was logged""" + output = self._get_log() + ok_(output == [], "Log is not empty: %s" % output) + def _check_log(self, linenum, regex): """Check that the specified line on log matches expectations""" if self._log is None: -- cgit v1.2.3