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 | e432a86f71929dc3ec00ab1664783aaa1afbcc8d (patch) | |
tree | 4181c48059649d1a2b8b599f902cc023e6275826 /test/test_cmdline.py | |
parent | 7f8bf5fe9cd67a6654f6b5993adec919ff16e23e (diff) | |
download | python-coveragepy-git-e432a86f71929dc3ec00ab1664783aaa1afbcc8d.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/test_cmdline.py')
-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 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") |