"""Smoke-test over the logger config.""" from argparse import ArgumentParser from pathlib import Path import pytest from aki_prj23_transparenzregister.utils.logger_config import ( add_logger_options_to_argparse, configer_logger, ) @pytest.mark.parametrize("parser", [True, False]) @pytest.mark.parametrize("path", [None, "test-log.log", ""]) @pytest.mark.parametrize("upper", [True, False]) @pytest.mark.parametrize("level", ["info", "debug", "error"]) def test_configer_logger( parser: bool, level: str, upper: bool, path: Path | str | None, ) -> None: """Tests the configuration of the logger. Args: parser: If the arguments should be given via the parser or not. level: The log-level to configure. upper: If the upper variant of the level should be used. path: The path where to save the log. """ if level.upper(): level = level.upper() if parser: args_parser = ArgumentParser() add_logger_options_to_argparse(args_parser) configer_logger( namespace=args_parser.parse_args( [ "--level", level if level else "", "--log-path", str(path) if path else "", ] ) ) else: configer_logger(level=level, path=path) # type: ignore def test_add_logger_options_to_argparse() -> None: """A test checking if the ArgumentParser is modified.""" args_parser = ArgumentParser() add_logger_options_to_argparse(args_parser)