diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-07 20:47:14 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-07 20:47:14 -0500 |
commit | 74adfa69b41443b3b83d6b14c2fc57fffb638384 (patch) | |
tree | 64e39562d7eec73ba669ed27402c12f627ae4caa /test | |
parent | 3889069edd7c6232573c5bdd4f351cf5c1755132 (diff) | |
download | python-coveragepy-git-74adfa69b41443b3b83d6b14c2fc57fffb638384.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.py | 12 | ||||
-rw-r--r-- | test/test_xml.py | 29 |
2 files changed, 35 insertions, 6 deletions
diff --git a/test/test_cmdline.py b/test/test_cmdline.py index e8e2336e..af46d954 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 00000000..ba17d430 --- /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") |