From 6ed29e2e25966c01b1226c98614d17cb4d913ad8 Mon Sep 17 00:00:00 2001 From: Anton Agestam Date: Sun, 20 Mar 2022 21:26:04 +0100 Subject: [PATCH] test coverage --- .github/workflows/ci.yaml | 2 +- abcattrs/type_hints.py | 2 +- tests/test_decorator.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3d2cef5..ec01fb2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,7 +36,7 @@ jobs: restore-keys: ${{ runner.os }}-pip - run: pip install -e '.[test]' - run: coverage run -m pytest - - run: coverage report && coverage xml + - run: coverage report -m && coverage xml - name: Report coverage uses: codecov/codecov-action@v2 with: diff --git a/abcattrs/type_hints.py b/abcattrs/type_hints.py index d102d93..e85bc5d 100644 --- a/abcattrs/type_hints.py +++ b/abcattrs/type_hints.py @@ -27,7 +27,7 @@ def get_resolvable_type_hints(cls: type) -> dict[str, type]: except NameError as exception: name = get_name_error_name(exception) local_ns[name] = ForwardRef(name) # type: ignore[assignment] - else: + else: # pragma: no cover raise MaxIterations( f"Exceeded {max_iterations} iterations trying to resolve type hints of " f"{cls.__module__}.{cls.__qualname__}." diff --git a/tests/test_decorator.py b/tests/test_decorator.py index a765332..a4256aa 100644 --- a/tests/test_decorator.py +++ b/tests/test_decorator.py @@ -13,6 +13,7 @@ def test_base_class_saves_attributes() -> None: @abstractattrs class A(abc.ABC): + bar: int foo: Abstract[int] assert not {"foo"} ^ A.__abstract_attributes__ # type: ignore[attr-defined]