|
Option C oc_diagnostics
|
Functions | |
| logging.LogRecord | _make_record (int level, str msg="test message") |
| test_handler_emit_info () | |
| test_handler_level_mapping () | |
| test_handler_custom_domain () | |
| test_handler_never_raises () | |
Variables | |
| _REPO_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) | |
Regression Tests — logging_handler
====================================
Purpose
-------
Verify that ``OcDiagnosticsHandler`` correctly bridges Python's ``logging``
module into ``oc_diagnostics._dbg()``, including level mapping, custom domain
routing, and the non-raising contract on internal exceptions.
Responsibilities
----------------
- Confirm that ``OcDiagnosticsHandler.emit()`` routes a LogRecord without raising.
- Confirm the default level map: DEBUG→L4, INFO→L2, WARNING/ERROR/CRITICAL→L1.
- Confirm that the handler's ``domain`` argument is forwarded to ``_dbg()``.
- Confirm that internal exceptions are swallowed (delegated to ``handleError``).
Diagnostics
-----------
Domain: TEST
Levels:
L2 — lifecycle
L3 — semantic details
L4 — deep tracing
Contracts
---------
- Must not permanently modify oc_diagnostics global state.
- Must not start servers or require network access.
- Must run deterministically across repeated invocations.
|
protected |
Build a minimal LogRecord for testing.
Definition at line 54 of file test_logging_handler.py.
| test_logging_handler.test_handler_custom_domain | ( | ) |
Handler's domain argument is forwarded as the first positional arg to _dbg().
Definition at line 120 of file test_logging_handler.py.
| test_logging_handler.test_handler_emit_info | ( | ) |
OcDiagnosticsHandler.emit() routes an INFO LogRecord through _dbg() without raising.
Definition at line 71 of file test_logging_handler.py.
| test_logging_handler.test_handler_level_mapping | ( | ) |
Default level map routes Python levels to oc_diagnostics levels correctly. DEBUG→L4, INFO→L2, WARNING→L1, ERROR→L1, CRITICAL→L1.
Definition at line 87 of file test_logging_handler.py.
| test_logging_handler.test_handler_never_raises | ( | ) |
OcDiagnosticsHandler.emit() must not propagate exceptions from _dbg().
Definition at line 138 of file test_logging_handler.py.
|
protected |
Definition at line 46 of file test_logging_handler.py.