diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-11-13 19:23:24 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-11-14 11:41:23 -0500 |
commit | 1c29ef3e4b871508bb2defd6b47b9a745547b626 (patch) | |
tree | 931fd2d7175321fd1549fd32e378cddcc99d2537 /tests/test_coverage.py | |
parent | 342e7da2941ae5291f1a94b6ad66ce489f6985fe (diff) | |
download | python-coveragepy-git-1c29ef3e4b871508bb2defd6b47b9a745547b626.tar.gz |
refactor: specialize exceptions
CoverageException is fine as a base class, but not good to use for
raising (and catching sometimes). Introduce specialized exceptions that
allow third-party tools to integrate better.
Diffstat (limited to 'tests/test_coverage.py')
-rw-r--r-- | tests/test_coverage.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_coverage.py b/tests/test_coverage.py index d69a0418..9fc7a001 100644 --- a/tests/test_coverage.py +++ b/tests/test_coverage.py @@ -7,7 +7,7 @@ import pytest import coverage from coverage import env -from coverage.exceptions import CoverageException +from coverage.exceptions import NoDataError from tests.coveragetest import CoverageTest @@ -1850,19 +1850,19 @@ class ReportingTest(CoverageTest): def test_no_data_to_report_on_annotate(self): # Reporting with no data produces a nice message and no output # directory. - with pytest.raises(CoverageException, match="No data to report."): + with pytest.raises(NoDataError, match="No data to report."): self.command_line("annotate -d ann") self.assert_doesnt_exist("ann") def test_no_data_to_report_on_html(self): # Reporting with no data produces a nice message and no output # directory. - with pytest.raises(CoverageException, match="No data to report."): + with pytest.raises(NoDataError, match="No data to report."): self.command_line("html -d htmlcov") self.assert_doesnt_exist("htmlcov") def test_no_data_to_report_on_xml(self): # Reporting with no data produces a nice message. - with pytest.raises(CoverageException, match="No data to report."): + with pytest.raises(NoDataError, match="No data to report."): self.command_line("xml") self.assert_doesnt_exist("coverage.xml") |