Skip to content

Commit

Permalink
full coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
will-ockmore committed Feb 17, 2024
1 parent bca32c7 commit 54353e4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/test_structlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ def test_capturing_level_fail() -> None:
logot.assert_not_logged(logged.debug("foo bar"))


def test_capturing_level_as_int_pass() -> None:
with Logot(capturer=StructlogCapturer).capturing(level=20) as logot:
logger.info("foo bar")
logot.assert_logged(logged.info("foo bar"))


def test_capturing_level_as_int_fail() -> None:
with Logot(capturer=StructlogCapturer).capturing(level=20) as logot:
logger.debug("foo bar")
logot.assert_not_logged(logged.debug("foo bar"))


def test_capturing_name_pass(stdlib_logger: None) -> None:
logger = structlog.get_logger("tests")
with Logot(capturer=StructlogCapturer).capturing(name="tests") as logot:
Expand All @@ -78,7 +90,6 @@ def test_capture(logot: Logot) -> None:
logot.assert_logged(logged.info("foo bar"))


@pytest.mark.skipif(structlog.__version__ < "22", reason="requires structlog>=22")
def test_capture_levelno(logot: Logot) -> None:
logger.log(20, "foo bar")
logot.assert_logged(logged.log(20, "foo bar"))

0 comments on commit 54353e4

Please sign in to comment.