summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-11-07 20:47:14 -0500
committerNed Batchelder <ned@nedbatchelder.com>2012-11-07 20:47:14 -0500
commit5bd1abb5a300fd22c852ae4fff0cc322840de1bf (patch)
tree1560fc39c16ccb80816ca2c97f449e18f41f2fe0 /test
parent03331d95005a3f782e12932f411f7ba7d51c9fbe (diff)
downloadpython-coveragepy-5bd1abb5a300fd22c852ae4fff0cc322840de1bf.tar.gz
Ugh. Setting the xml output file in the .coveragerc file simply didn't work. Now it does.
Diffstat (limited to 'test')
-rw-r--r--test/test_cmdline.py12
-rw-r--r--test/test_xml.py29
2 files changed, 35 insertions, 6 deletions
diff --git a/test/test_cmdline.py b/test/test_cmdline.py
index e8e2336..af46d95 100644
--- a/test/test_cmdline.py
+++ b/test/test_cmdline.py
@@ -553,11 +553,11 @@ class NewCmdLineTest(CmdLineTest):
# coverage xml [-i] [--omit DIR,...] [FILE1 FILE2 ...]
self.cmd_executes("xml", self.INIT_LOAD + """\
.xml_report(ignore_errors=None, omit=None, include=None, morfs=[],
- outfile="coverage.xml")
+ outfile=None)
""")
self.cmd_executes("xml -i", self.INIT_LOAD + """\
.xml_report(ignore_errors=True, omit=None, include=None, morfs=[],
- outfile="coverage.xml")
+ outfile=None)
""")
self.cmd_executes("xml -o myxml.foo", self.INIT_LOAD + """\
.xml_report(ignore_errors=None, omit=None, include=None, morfs=[],
@@ -571,21 +571,21 @@ class NewCmdLineTest(CmdLineTest):
.coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, source=None, include=None, omit=["fooey"])
.load()
.xml_report(ignore_errors=None, omit=["fooey"], include=None, morfs=[],
- outfile="coverage.xml")
+ outfile=None)
""")
self.cmd_executes("xml --omit fooey,booey", """\
.coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, source=None, include=None, omit=["fooey", "booey"])
.load()
.xml_report(ignore_errors=None, omit=["fooey", "booey"], include=None,
- morfs=[], outfile="coverage.xml")
+ morfs=[], outfile=None)
""")
self.cmd_executes("xml mod1", self.INIT_LOAD + """\
.xml_report(ignore_errors=None, omit=None, include=None, morfs=["mod1"],
- outfile="coverage.xml")
+ outfile=None)
""")
self.cmd_executes("xml mod1 mod2 mod3", self.INIT_LOAD + """\
.xml_report(ignore_errors=None, omit=None, include=None,
- morfs=["mod1", "mod2", "mod3"], outfile="coverage.xml")
+ morfs=["mod1", "mod2", "mod3"], outfile=None)
""")
def test_no_arguments_at_all(self):
diff --git a/test/test_xml.py b/test/test_xml.py
new file mode 100644
index 0000000..ba17d43
--- /dev/null
+++ b/test/test_xml.py
@@ -0,0 +1,29 @@
+"""Tests for XML reports from coverage.py."""
+
+import os, sys
+
+sys.path.insert(0, os.path.split(__file__)[0]) # Force relative import for Py3k
+from coveragetest import CoverageTest
+
+class XmlReportTest(CoverageTest):
+ """Tests of the XML reports from coverage.py."""
+
+ def setUp(self):
+ super(XmlReportTest, self).setUp()
+ self.make_file("mycode.py", "print('hello')\n")
+ self.run_command("coverage run mycode.py")
+
+ def test_default_file_placement(self):
+ self.run_command("coverage xml")
+ self.assert_exists("coverage.xml")
+
+ def test_argument_affects_xml_placement(self):
+ self.run_command("coverage xml -o put_it_there.xml")
+ self.assert_doesnt_exist("coverage.xml")
+ self.assert_exists("put_it_there.xml")
+
+ def test_config_affects_xml_placement(self):
+ self.make_file(".coveragerc", "[xml]\noutput = xml.out\n")
+ self.run_command("coverage xml")
+ self.assert_doesnt_exist("coverage.xml")
+ self.assert_exists("xml.out")