diff --git a/metacov.ini b/metacov.ini index 884babf7e..84321712e 100644 --- a/metacov.ini +++ b/metacov.ini @@ -43,6 +43,9 @@ exclude_lines = # pragma: nested + # Abstract methods + raise NotImplementedError + # Lines that are only executed when we are debugging coverage.py. def __repr__ pragma: debugging diff --git a/tests/test_api.py b/tests/test_api.py index cbc35b1af..dcdebe97d 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -15,7 +15,7 @@ import sys import textwrap -from typing import cast, Callable, Dict, Iterable, List, Optional, Protocol, Set +from typing import cast, Callable, Dict, Iterable, List, Optional, Set import pytest @@ -814,19 +814,14 @@ def test_bug_572(self) -> None: cov.report() -class CoverageUsePkgs(Protocol): - """A number of test classes have the same helper method.""" - def coverage_usepkgs( - self, - **kwargs: TCovKwargs, - ) -> Iterable[str]: - """Run coverage on usepkgs, return a line summary. kwargs are for Coverage(**kwargs).""" - return "" - - -class IncludeOmitTestsMixin(CoverageUsePkgs, UsingModulesMixin, CoverageTest): +class IncludeOmitTestsMixin(UsingModulesMixin, CoverageTest): """Test methods for coverage methods taking include and omit.""" + # An abstract method for subclasses to define, to appease mypy. + def coverage_usepkgs(self, **kwargs_unused: TCovKwargs) -> Iterable[str]: + """Run coverage on usepkgs, return a line summary. kwargs are for Coverage(**kwargs).""" + raise NotImplementedError() + def filenames_in(self, summary: Iterable[str], filenames: str) -> None: """Assert the `filenames` are in the `summary`.""" for filename in filenames.split():