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 | 556ed1ae242ba561e4703f709178f9c67f66819c (patch) | |
tree | 5be7dd266f104fe757a63a140a3b1501d2ebdad7 /tests/test_xml.py | |
parent | f0a4a26688f3532a31e48549bcf758a48d15581b (diff) | |
download | python-coveragepy-556ed1ae242ba561e4703f709178f9c67f66819c.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 bc8c051..2d80521 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() |