From 1c29ef3e4b871508bb2defd6b47b9a745547b626 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 13 Nov 2021 19:23:24 -0500 Subject: 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. --- tests/test_coverage.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/test_coverage.py') 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") -- cgit v1.2.1