Fix/improve unit tests (#1281)

* Fix conditional import.

* Don't count lines for code coverage which should never execute.

* Fix tests to use pytest.raises.
This commit is contained in:
Felix Fontein
2026-06-06 21:27:09 +02:00
committed by GitHub
parent 604747372d
commit ce69e51d73
8 changed files with 22 additions and 25 deletions
@@ -21,11 +21,13 @@ from ..test_support.docker_image_archive_stubbing import (
)
if t.TYPE_CHECKING:
from collections.abc import Callable
from collections.abc import Callable # pragma: no cover
def assert_no_logging(msg: str) -> t.NoReturn:
raise AssertionError(f"Should not have logged anything but logged {msg}")
raise AssertionError(
f"Should not have logged anything but logged {msg}"
) # pragma: no cover
def capture_logging(messages: list[str]) -> Callable[[str], None]: