From e432a86f71929dc3ec00ab1664783aaa1afbcc8d Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 27 Sep 2009 10:01:05 -0400 Subject: Added a 'coverage debug' command to get internal information for diagnosing problems. Also, all commands should at least take -h. --- test/test_cmdline.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test_cmdline.py b/test/test_cmdline.py index d2413712..7e7cba2a 100644 --- a/test/test_cmdline.py +++ b/test/test_cmdline.py @@ -66,18 +66,23 @@ class CmdLineTest(CoverageTest): self.assertEqual(m1.method_calls, m2.method_calls) def cmd_help(self, args, help_msg=None, topic=None, ret=ERR): - """Run a command line, and check that it prints the right help.""" + """Run a command line, and check that it prints the right help. + + Only the last function call in the mock is checked, which should be the + help message that we want to see. + + """ m, r = self.mock_command_line(args) self.assertEqual(r, ret, "Wrong status: got %s, wanted %s" % (r, ret) ) if help_msg: - self.assertEqual(m.method_calls, - [('help_fn', (help_msg,), {})] + self.assertEqual(m.method_calls[-1], + ('help_fn', (help_msg,), {}) ) else: - self.assertEqual(m.method_calls, - [('help_fn', (), {'topic':topic})] + self.assertEqual(m.method_calls[-1], + ('help_fn', (), {'topic':topic}) ) @@ -340,6 +345,16 @@ class NewCmdLineTest(CmdLineTest): def testCombine(self): self.cmd_executes_same("combine", "-c") + def testDebug(self): + self.cmd_help("debug", "What information would you like: data, sys?") + self.cmd_help("debug foo", "Don't know what you mean by 'foo'") + + def testDebugSys(self): + self.command_line("debug sys") + out = self.stdout() + assert "version:" in out + assert "data_file:" in out + def testErase(self): self.cmd_executes_same("erase", "-e") -- cgit v1.2.1