diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-01-19 11:44:07 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-01-19 11:44:07 -0500 |
commit | 99a6946cdc2a646b965df5826e9165a26271cd03 (patch) | |
tree | 2a4c6342757591da3c092caea4b045ec9c1da743 /tests/test_xml.py | |
parent | cf5a9f0e6001cae65e57d6592cced37a460ea642 (diff) | |
download | python-coveragepy-git-99a6946cdc2a646b965df5826e9165a26271cd03.tar.gz |
Clean up the XML tests a little
Diffstat (limited to 'tests/test_xml.py')
-rw-r--r-- | tests/test_xml.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/tests/test_xml.py b/tests/test_xml.py index bc8c0516..2d805219 100644 --- a/tests/test_xml.py +++ b/tests/test_xml.py @@ -7,14 +7,27 @@ import coverage from tests.coveragetest import CoverageTest -class XmlReportTest(CoverageTest): - """Tests of the XML reports from coverage.py.""" +class XmlTestHelpers(CoverageTest): + """Methods to use from XML tests.""" def run_mycode(self): """Run mycode.py, so we can report on it.""" self.make_file("mycode.py", "print('hello')\n") self.run_command("coverage run mycode.py") + def run_doit(self): + """Construct a simple sub-package.""" + self.make_file("sub/__init__.py") + self.make_file("sub/doit.py", "print('doit!')") + self.make_file("main.py", "import sub.doit") + cov = coverage.coverage() + self.start_import_stop(cov, "main") + return cov + + +class XmlReportTest(XmlTestHelpers, CoverageTest): + """Tests of the XML reports from coverage.py.""" + def test_default_file_placement(self): self.run_mycode() self.run_command("coverage xml") @@ -55,15 +68,6 @@ class XmlReportTest(CoverageTest): cov.xml_report(ignore_errors=True) self.assert_exists("coverage.xml") - def run_doit(self): - """Construct a simple sub-package.""" - self.make_file("sub/__init__.py") - self.make_file("sub/doit.py", "print('doit!')") - self.make_file("main.py", "import sub.doit") - cov = coverage.coverage() - self.start_import_stop(cov, "main") - return cov - def test_filename_format_showing_everything(self): cov = self.run_doit() cov.xml_report(outfile="-") @@ -99,6 +103,7 @@ class XmlReportTest(CoverageTest): self.assertIn('line-rate="1"', empty_line) def test_empty_file_is_100_not_0(self): + # https://bitbucket.org/ned/coveragepy/issue/345 cov = self.run_doit() cov.xml_report(outfile="-") xml = self.stdout() |