| 1 |
"""Tests for ``_cli`` module. |
| 2 |
|
| 3 |
``_cli.cli`` is not really good testable with unit tests. |
| 4 |
Therefore tests are in the ``integration_tests`` directory. |
| 5 |
""" |
| 6 |
|
| 7 |
from __future__ import annotations |
| 8 |
|
| 9 |
import pytest |
| 10 |
|
| 11 |
from rstcheck import _cli |
| 12 |
|
| 13 |
|
| 14 |
@pytest.mark.parametrize("level", ["SEVERE", "NONE"]) |
| 15 |
def test_setup_logger_errors_on_invalid_levels(level: str) -> None: |
| 16 |
"""Tests exception is raised on invalid levels.""" |
| 17 |
with pytest.raises(TypeError, match=f"Invalid log level: {level}"): |
| 18 |
_cli.setup_logger(level) |
| 19 |
|
| 20 |
|
| 21 |
@pytest.mark.parametrize("level", ["debug", "InFO", "WARNING", "ErRor", "critical"]) |
| 22 |
def test_setup_logger_valid_levels(level: str) -> None: |
| 23 |
"""Test no exception is raised on valid levels.""" |
| 24 |
_cli.setup_logger(level) |