diff options
author | Guido Günther <agx@sigxcpu.org> | 2015-03-26 16:47:20 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2015-03-27 12:16:31 +0100 |
commit | 0b98c48cbe28a01e325d4877ab76395db6548461 (patch) | |
tree | 892d1086ad44756abcea3ccaa031304d2800986c | |
parent | 8de3ae9567e821ad8432f67afd8756b35189ecba (diff) |
gbplogtester: add helper to test for empty log
-rw-r--r-- | tests/18_test_Config.py | 4 | ||||
-rw-r--r-- | 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: |