diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-09-27 10:01:05 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-09-27 10:01:05 -0400 |
commit | c4c25e13b8468655ff69c9783df4534c217730be (patch) | |
tree | 4b8e90115c2145cd3911f9a7983f7cc0fa140ddd /test | |
parent | bc89904a4566cec370e7ad5166b0ab791b911035 (diff) | |
download | python-coveragepy-c4c25e13b8468655ff69c9783df4534c217730be.tar.gz |
Added a 'coverage debug' command to get internal information for diagnosing problems. Also, all commands should at least take -h.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_cmdline.py | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/test/test_cmdline.py b/test/test_cmdline.py index d241371..7e7cba2 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") |