e4dcfc49aa
Tests / Import Check (Python 3.13) (push) Has been cancelled
Tests / Import Check (Python 3.14) (push) Has been cancelled
Tests / Python Tests (Python 3.11) (push) Has been cancelled
Tests / Python Tests (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.14) (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
Tests / Lint and Format (push) Has been cancelled
Tests / Web Node Tests (push) Has been cancelled
Tests / Import Check (Python 3.11) (push) Has been cancelled
Tests / Import Check (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.13) (push) Has been cancelled
20 lines
650 B
Python
20 lines
650 B
Python
import logging
|
|
|
|
import pytest
|
|
|
|
from deeptutor.logging import bind_log_context, capture_process_logs
|
|
from deeptutor.logging.loguru_bridge import install_loguru_bridge
|
|
|
|
|
|
def test_loguru_bridge_forwards_to_stdlib_process_capture():
|
|
loguru = pytest.importorskip("loguru")
|
|
events = []
|
|
|
|
assert install_loguru_bridge(logging.DEBUG) is True
|
|
with bind_log_context(task_id="loguru-task"):
|
|
with capture_process_logs(events.append, task_id="loguru-task"):
|
|
loguru.logger.info("hello from loguru")
|
|
|
|
assert [event.message for event in events] == ["hello from loguru"]
|
|
assert events[0].context["task_id"] == "loguru-task"
|