From ebdc9a9a76b1c523a9158cf53c0398a5bffdac8d Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Wed, 27 Dec 2023 16:47:13 +0200 Subject: [PATCH] Adjust test coverage Signed-off-by: Aarni Koskela --- pyproject.toml | 10 ++++++++++ tests/paho_test.py | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5158ccad..c0e7527c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,3 +106,13 @@ line-length = 167 "S105", "S106", ] + +[tool.coverage.report] +exclude_also = [ + "@(abc\\.)?abstractmethod", + "def __repr__", + "except ImportError:", + "if TYPE_CHECKING:", + "raise AssertionError", + "raise NotImplementedError", +] diff --git a/tests/paho_test.py b/tests/paho_test.py index 77eb686b..4c77fb30 100644 --- a/tests/paho_test.py +++ b/tests/paho_test.py @@ -62,7 +62,7 @@ def expect_packet(sock, name, expected): if len(data) == 0: break packet_recvd += data - except socket.timeout: + except socket.timeout: # pragma: no cover pass assert packet_matches(name, packet_recvd, expected) @@ -88,7 +88,7 @@ def expect_no_packet(sock, delay=1): def packet_matches(name, recvd, expected): - if recvd != expected: + if recvd != expected: # pragma: no cover print(f"FAIL: Received incorrect {name}.") dump_packet("Received", recvd) dump_packet("Expected", expected)