Skip to content

Commit

Permalink
feat: finaly maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
cofin committed Dec 16, 2024
1 parent 0e110c6 commit 7cacc10
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 35 deletions.
30 changes: 25 additions & 5 deletions tests/unit/test_logging/test_logging_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_dictconfig_on_startup(logging_module: str, dict_config_not_called: str)
[
[
"logging",
"logging.QueueHandler"
"logging.handlers.QueueHandler"
if sys.version_info >= (3, 12, 0)
else "litestar.logging.standard.QueueListenerHandler",
"litestar.logging.standard.LoggingQueueListener",
Expand All @@ -150,6 +150,10 @@ def test_default_queue_listener_handler(
elif expected_handler_class_str == "litestar.logging.picologging.QueueListenerHandler":
from litestar.logging.picologging import QueueListenerHandler

expected_handler_class = QueueListenerHandler
elif expected_handler_class_str == "logging.handlers.QueueHandler":
from logging.handlers import QueueHandler as QueueListenerHandler

expected_handler_class = QueueListenerHandler
else:
expected_handler_class = importlib.import_module(expected_handler_class_str)
Expand Down Expand Up @@ -221,7 +225,7 @@ def test_get_logger_without_logging_config() -> None:
[
[
"logging",
"logging.QueueHandler"
"logging.handlers.QueueHandler"
if sys.version_info >= (3, 12, 0)
else "litestar.logging.standard.QueueListenerHandler",
],
Expand All @@ -237,6 +241,10 @@ def test_default_loggers(logging_module_str: str, expected_handler_class_str: st
elif expected_handler_class_str == "litestar.logging.picologging.QueueListenerHandler":
from litestar.logging.picologging import QueueListenerHandler

expected_handler_class = QueueListenerHandler
elif expected_handler_class_str == "logging.handlers.QueueHandler":
from logging.handlers import QueueHandler as QueueListenerHandler

expected_handler_class = QueueListenerHandler
else:
expected_handler_class = importlib.import_module(expected_handler_class_str)
Expand All @@ -260,7 +268,7 @@ def test_default_loggers(logging_module_str: str, expected_handler_class_str: st
[
[
"logging",
"litestar.logging.standard.QueueListenerHandler"
"logging.handlers.QueueHandler"
if sys.version_info >= (3, 12, 0)
else "litestar.logging.standard.QueueListenerHandler",
],
Expand All @@ -276,6 +284,10 @@ def test_connection_logger(logging_module_str: str, expected_handler_class_str:
elif expected_handler_class_str == "litestar.logging.picologging.QueueListenerHandler":
from litestar.logging.picologging import QueueListenerHandler

expected_handler_class = QueueListenerHandler
elif expected_handler_class_str == "logging.handlers.QueueHandler":
from logging.handlers import QueueHandler as QueueListenerHandler

expected_handler_class = QueueListenerHandler
else:
expected_handler_class = importlib.import_module(expected_handler_class_str)
Expand Down Expand Up @@ -329,7 +341,7 @@ def test_validation(logging_module_str: Optional[str]) -> None:
[
[
"logging",
"logging.QueueHandler"
"logging.handlers.QueueHandler"
if sys.version_info >= (3, 12, 0)
else "litestar.logging.standard.QueueListenerHandler",
],
Expand All @@ -345,6 +357,10 @@ def test_root_logger(logging_module_str: str, expected_handler_class_str: str) -
elif expected_handler_class_str == "litestar.logging.picologging.QueueListenerHandler":
from litestar.logging.picologging import QueueListenerHandler

expected_handler_class = QueueListenerHandler
elif expected_handler_class_str == "logging.handlers.QueueHandler":
from logging.handlers import QueueHandler as QueueListenerHandler

expected_handler_class = QueueListenerHandler
else:
expected_handler_class = importlib.import_module(expected_handler_class_str)
Expand Down Expand Up @@ -383,7 +399,7 @@ def test_root_logger_no_config(logging_module_str: str) -> None:
[
"logging",
True,
"logging.QueueHandler"
"logging.handlers.QueueHandler"
if sys.version_info >= (3, 12, 0)
else "litestar.logging.standard.QueueListenerHandler",
],
Expand All @@ -408,6 +424,10 @@ def test_customizing_handler(
elif expected_root_logger_handler_class_str == "litestar.logging.picologging.QueueListenerHandler":
from litestar.logging.picologging import QueueListenerHandler

expected_root_logger_handler_class = QueueListenerHandler
elif expected_root_logger_handler_class_str == "logging.handlers.QueueHandler":
from logging.handlers import QueueHandler as QueueListenerHandler

expected_root_logger_handler_class = QueueListenerHandler
else:
expected_root_logger_handler_class = importlib.import_module(expected_root_logger_handler_class_str)
Expand Down
33 changes: 3 additions & 30 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7cacc10

Please sign in to comment.