Skip to content

Commit

Permalink
✅ Cover logger
Browse files Browse the repository at this point in the history
  • Loading branch information
valentingol committed Jan 12, 2024
1 parent e112ba1 commit 8392d34
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/unit/test_logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2023 Valentin Goldite. All Rights Reserved.
"""Tests for dict routines."""
import pytest
import pytest_check as check

from cliconfig._logger import create_logger


def test_create_logger(
caplog: pytest.CaptureFixture,
capsys: pytest.CaptureFixture,
) -> None:
"""Test create_logger."""
logger = create_logger()
logger.info("This is an info message.")
check.is_true("INFO cliconfig._logger:test_logger.py:" in caplog.text)
check.is_true(" This is an info message." in caplog.text)
check.is_true("INFO - This is an info message." in capsys.readouterr().out)
logger.warning("This is a warning message.")
check.is_true("WARNING cliconfig._logger:test_logger.py:" in caplog.text)
check.is_true(" This is a warning message." in caplog.text)
check.is_true("WARNING - This is a warning message." in capsys.readouterr().out)

0 comments on commit 8392d34

Please sign in to comment.