diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-09-25 21:47:36 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-09-25 21:47:36 -0400 |
commit | 17e6ca309e07186eed46242b1903a84c9bc5e167 (patch) | |
tree | 8a4df6d5f8e28429baad275cc0058f3d1654e5ba /test/test_cmdline.py | |
parent | bc6d5e8768017eb474d00af2828895f5199c05c6 (diff) | |
download | python-coveragepy-git-17e6ca309e07186eed46242b1903a84c9bc5e167.tar.gz |
XML command writes to coverage.xml, and takes a -o argument to write it somewhere else.
Diffstat (limited to 'test/test_cmdline.py')
-rw-r--r-- | test/test_cmdline.py | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/test/test_cmdline.py b/test/test_cmdline.py index eb4e7cd4..d2413712 100644 --- a/test/test_cmdline.py +++ b/test/test_cmdline.py @@ -13,6 +13,10 @@ OK, ERR = 0, 1 class CmdLineTest(CoverageTest): """Tests of execution paths through the command line interpreter.""" + INIT_LOAD = """\ + .coverage(cover_pylib=None, data_suffix=False, timid=None) + .load()\n""" + def command_line(self, args, ret=OK): """Run `args` through the command line. @@ -80,10 +84,6 @@ class CmdLineTest(CoverageTest): class ClassicCmdLineTest(CmdLineTest): """Tests of the classic coverage.py command line.""" - INIT_LOAD = """\ - .coverage(cover_pylib=None, data_suffix=False, timid=None) - .load()\n""" - def testErase(self): # coverage -e self.cmd_executes("-e", """\ @@ -378,6 +378,41 @@ class NewCmdLineTest(CmdLineTest): self.cmd_executes_same("run --timid f.py", "-e -x --timid f.py") self.cmd_executes_same("run", "-x") + def testXml(self): + # coverage xml [-i] [--omit DIR,...] [FILE1 FILE2 ...] + self.cmd_executes("xml", self.INIT_LOAD + """\ + .xml_report(ignore_errors=None, omit_prefixes=None, morfs=[], + outfile="coverage.xml") + """) + self.cmd_executes("xml -i", self.INIT_LOAD + """\ + .xml_report(ignore_errors=True, omit_prefixes=None, morfs=[], + outfile="coverage.xml") + """) + self.cmd_executes("xml -o myxml.foo", self.INIT_LOAD + """\ + .xml_report(ignore_errors=None, omit_prefixes=None, morfs=[], + outfile="myxml.foo") + """) + self.cmd_executes("xml -o -", self.INIT_LOAD + """\ + .xml_report(ignore_errors=None, omit_prefixes=None, morfs=[], + outfile=None) + """) + self.cmd_executes("xml --omit fooey", self.INIT_LOAD + """\ + .xml_report(ignore_errors=None, omit_prefixes=["fooey"], morfs=[], + outfile="coverage.xml") + """) + self.cmd_executes("xml --omit fooey,booey", self.INIT_LOAD + """\ + .xml_report(ignore_errors=None, omit_prefixes=["fooey", "booey"], + morfs=[], outfile="coverage.xml") + """) + self.cmd_executes("xml mod1", self.INIT_LOAD + """\ + .xml_report(ignore_errors=None, omit_prefixes=None, morfs=["mod1"], + outfile="coverage.xml") + """) + self.cmd_executes("xml mod1 mod2 mod3", self.INIT_LOAD + """\ + .xml_report(ignore_errors=None, omit_prefixes=None, + morfs=["mod1", "mod2", "mod3"], outfile="coverage.xml") + """) + def testNoArgumentsAtAll(self): self.cmd_help("", topic="minimum_help", ret=OK) |