diff options
author | Ionel Cristian Maries <contact@ionelmc.ro> | 2015-06-28 23:30:06 +0300 |
---|---|---|
committer | Ionel Cristian Maries <contact@ionelmc.ro> | 2015-06-28 23:30:06 +0300 |
commit | d42bc6cae5911ecb1b64c8c98d8e7acee9e4b074 (patch) | |
tree | 9e515007590bd7a83de84a9898923fd0a4245c24 | |
parent | 040a2b502156f86ca24b6d7b295260888b290b27 (diff) | |
download | python-coveragepy-git-d42bc6cae5911ecb1b64c8c98d8e7acee9e4b074.tar.gz |
Fix various assertions.
-rw-r--r-- | tests/test_api.py | 3 | ||||
-rw-r--r-- | tests/test_summary.py | 10 |
2 files changed, 9 insertions, 4 deletions
diff --git a/tests/test_api.py b/tests/test_api.py index baf1f016..1667c5f4 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -7,6 +7,7 @@ import textwrap import coverage from coverage.backward import StringIO +from coverage.misc import CoverageException from tests.coveragetest import CoverageTest @@ -245,7 +246,7 @@ class ApiTest(CoverageTest): # Used to be you'd get an exception reporting on nothing... cov = coverage.coverage() cov.erase() - cov.report() + self.assertRaises(CoverageException, cov.report) def test_start_stop_start_stop(self): self.make_file("code1.py", """\ diff --git a/tests/test_summary.py b/tests/test_summary.py index ebf9e1f4..6e7dbeba 100644 --- a/tests/test_summary.py +++ b/tests/test_summary.py @@ -342,8 +342,9 @@ class SummaryTest(CoverageTest): # Name Stmts Miss Cover # ---------------------------- # mycode NotPython: Couldn't parse '/tmp/test_cover/63354509363/mycode.py' as Python source: 'invalid syntax' at line 1 + # No data to report. - last = self.last_line_squeezed(report) + last = self.squeezed_lines(report)[-2] # The actual file name varies run to run. last = re.sub(r"parse '.*mycode.py", "parse 'mycode.py", last) # The actual error message varies version to version @@ -365,7 +366,8 @@ class SummaryTest(CoverageTest): # Name Stmts Miss Cover # ---------------------------- - self.assertEqual(self.line_count(report), 2) + self.assertEqual(self.line_count(report), 3) + self.assertIn('No data to report.', report) def test_dothtml_not_python(self): # We run a .html file, and when reporting, we can't parse it as @@ -380,8 +382,10 @@ class SummaryTest(CoverageTest): # Name Stmts Miss Cover # ---------------------------- + # No data to report. - self.assertEqual(self.line_count(report), 2) + self.assertEqual(self.line_count(report), 3) + self.assertIn('No data to report.', report) def get_report(self, cov): """Get the report from `cov`, and canonicalize it.""" |