Skip to content

Commit

Permalink
adding coverage exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
bandophahita committed Apr 3, 2024
1 parent e5736dc commit 340b25e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,10 @@ playwright = ["screenpy-playwright"]
pyotp = ["screenpy-pyotp"]
requests = ["screenpy-requests"]
selenium = ["screenpy-selenium"]


[tool.coverage.report]
exclude_also = [
"if TYPE_CHECKING:",
"pass",
]
4 changes: 2 additions & 2 deletions screenpy/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

from pydantic.fields import FieldInfo

if sys.version_info >= (3, 11):
if sys.version_info >= (3, 11): # pragma: no cover
try:
import tomllib
except ImportError:
if not TYPE_CHECKING:
# Help users on older alphas
import tomli as tomllib
else:
else: # pragma: no cover
import tomli as tomllib


Expand Down
2 changes: 1 addition & 1 deletion tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ def test_output_first_passes(
) -> None:
class FakeActionFail(Performable):
@beat("{} tries to FakeActionFail")
def perform_as(self, _: Actor) -> None:
def perform_as(self, _: Actor) -> None: # pragma: no cover
msg = "This Fails!"
raise AssertionError(msg)

Expand Down
6 changes: 3 additions & 3 deletions tests/test_pacing.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ def do_not_log_me_man(self) -> None:
@beat("Foobar...")
def does_return_something(self, toggle: bool = False) -> Optional[int]:
if toggle:
return 1
return 1 # pragma: no cover
return None

# purposfully not annotated
@beat("Baz?")
# type: ignore[no-untyped-def]
def no_annotations_rt_none(self, toggle=False): # noqa: ANN001, ANN201
if toggle:
return 1
return 1 # pragma: no cover
return None

# purposfully not annotated
Expand All @@ -68,7 +68,7 @@ def no_annotations_rt_none(self, toggle=False): # noqa: ANN001, ANN201
def no_annotations_rt_int(self, toggle=False): # noqa: ANN001, ANN201
if toggle:
return 1
return None
return None # pragma: no cover

def describe(self) -> str:
return "CornerCase"
Expand Down
6 changes: 3 additions & 3 deletions tests/test_pacing_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ def do_not_log_me_man(self) -> None:
@beat("Foobar...")
def does_return_something(self, toggle: bool = False) -> int | None:
if toggle:
return 1
return 1 # pragma: no cover
return None

# purposfully not annotated
@beat("Baz?")
# type: ignore[no-untyped-def]
def no_annotations_rt_none(self, toggle=False): # noqa: ANN001, ANN201
if toggle:
return 1
return 1 # pragma: no cover
return None

# purposfully not annotated
Expand All @@ -46,7 +46,7 @@ def no_annotations_rt_none(self, toggle=False): # noqa: ANN001, ANN201
def no_annotations_rt_int(self, toggle=False): # noqa: ANN001, ANN201
if toggle:
return 1
return None
return None # pragma: no cover

def describe(self) -> str:
return "CornerCase"
Expand Down
6 changes: 4 additions & 2 deletions tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import os
from pathlib import Path
from unittest import mock
Expand Down Expand Up @@ -69,7 +71,7 @@ def test_init_overwrites_env(self) -> None:
def test_can_be_changed_at_runtime(self) -> None:
try:
screenpy_settings.TIMEOUT = 4
except TypeError as exc:
except TypeError as exc: # pragma: no cover
msg = "ScreenPySettings could not be changed at runtime."
raise AssertionError(msg) from exc

Expand Down Expand Up @@ -108,7 +110,7 @@ def test_init_overwrites_env(self) -> None:
def test_can_be_changed_at_runtime(self) -> None:
try:
stdout_adapter_settings.INDENT_CHAR = "?"
except TypeError as exc:
except TypeError as exc: # pragma: no cover
msg = "StdOutAdapterSettings could not be changed at runtime."
raise AssertionError(msg) from exc

Expand Down

0 comments on commit 340b25e

Please sign in to comment.