141 print(
"\noc_diagnostics — Test Suite")
147 _ud_runner._init_warned =
True
152 print(
"\n[Core tests — unified_debug]")
153 import test_unified_debug
as _tud
154 _run(
"config_loading", _tud.test_config_loading)
155 _run(
"config_source_populated", _tud.test_config_source_populated)
156 _run(
"dbg_silent_no_exception", _tud.test_dbg_silent_no_exception)
157 _run(
"dbg_level_filtering", _tud.test_dbg_level_filtering)
158 _run(
"dbg_override_flag", _tud.test_dbg_override_flag)
159 _run(
"dbg_before_init_warning", _tud.test_dbg_before_init_warning)
160 _run(
"adbg_does_not_raise", _tud.test_adbg_does_not_raise)
161 _run(
"init_idempotent", _tud.test_init_idempotent)
162 _run(
"stream_interceptor_interface",_tud.test_stream_interceptor_interface)
163 _run(
"debug_levels_dict_mutable", _tud.test_debug_levels_dict_mutable)
164 _run(
"set_debug_level_valid", _tud.test_set_debug_level_valid)
165 _run(
"set_debug_level_invalid", _tud.test_set_debug_level_invalid)
166 _run(
"set_global_setting_valid", _tud.test_set_global_setting_valid)
167 _run(
"set_global_setting_invalid", _tud.test_set_global_setting_invalid)
168 _run(
"json_output_mode", _tud.test_json_output_mode)
169 _run(
"dbg_timed_context_manager", _tud.test_dbg_timed)
170 _run(
"dbg_scope_enter_exit", _tud.test_dbg_scope)
171 _run(
"dbg_profile_decorator", _tud.test_dbg_profile)
172 _run(
"prod_mode_env_var", _tud.test_prod_mode_env_var)
173 _run(
"prod_mode_via_config", _tud.test_prod_mode_via_config)
174 _run(
"log_rotation_count", _tud.test_log_rotation_count)
175 _run(
"reload_stale_key_removed", _tud.test_reload_stale_key_removed)
176 _run(
"io_degradation_oserror", _tud.test_io_degradation_oserror)
181 print(
"\n[Logging handler tests]")
182 import test_logging_handler
as _tlh
183 _run(
"handler_emit_info", _tlh.test_handler_emit_info)
184 _run(
"handler_level_mapping", _tlh.test_handler_level_mapping)
185 _run(
"handler_custom_domain", _tlh.test_handler_custom_domain)
186 _run(
"handler_never_raises", _tlh.test_handler_never_raises)
191 print(
"\n[FastAPI middleware tests — pure ASGI contract]")
192 import test_fastapi_middleware
as _tfm
193 _run(
"fastapi_http_scope_status", _tfm.test_http_scope_status_passthrough)
194 _run(
"fastapi_websocket_passthrough", _tfm.test_websocket_passthrough)
195 _run(
"fastapi_lifespan_passthrough", _tfm.test_lifespan_scope_passthrough)
196 _run(
"fastapi_exception_reraise", _tfm.test_exception_reraise)
197 _run(
"fastapi_http_header_redaction", _tfm.test_http_header_redaction)
198 _run(
"fastapi_elapsed_time_in_log", _tfm.test_elapsed_time_in_log)
203 print(
"\n[Dash tests — skipped automatically when Dash is not installed]")
206 _dash_available =
True
208 _dash_available =
False
210 if not _dash_available:
211 _record(SKIP,
"dash_tests",
"Dash not installed — skipping all Dash tests")
213 import test_id_instrumentation
as _tid
214 _run(
"structural_id_protection", _tid.test_structural_id_protection)
215 _run(
"instrument_ids_basic", _tid.test_instrument_ids_basic)
216 _run(
"dict_id_not_rewritten", _tid.test_dict_id_not_rewritten)
217 _run(
"no_id_component_unchanged", _tid.test_no_id_component_unchanged)
218 _run(
"max_depth_limit", _tid.test_max_depth_limit)
219 _run(
"nested_children_traversal", _tid.test_nested_children_traversal)
220 _run(
"additional_structural_prefixes", _tid.test_additional_structural_prefixes)
221 _run(
"additional_structural_exact", _tid.test_additional_structural_exact)
223 import test_instrumentation_middleware
as _tim
224 _run(
"apply_instrumentation_no_op", _tim.test_apply_instrumentation_no_op)
225 _run(
"apply_list_return", _tim.test_apply_list_return)
226 _run(
"apply_tuple_return", _tim.test_apply_tuple_return)
227 _run(
"apply_single_component", _tim.test_apply_single_component)
228 _run(
"no_double_wrapping", _tim.test_no_double_wrapping)
230 import test_ui_event_logger
as _tuel
231 _run(
"ui_event_logger_import", _tuel.test_ui_event_logger_import)
232 _run(
"required_store_id_constant", _tuel.test_required_store_id_constant)
233 _run(
"ui_logger_custom_props", _tuel.test_ui_logger_custom_props)
240 passed = sum(1
for s, _, _
in _results
if s == PASS)
241 failed = sum(1
for s, _, _
in _results
if s == FAIL)
242 skipped = sum(1
for s, _, _
in _results
if s == SKIP)
243 total = len(_results)
245 print(
"\n" +
"=" * 60)
247 f
"Results: {passed} passed, {failed} failed, {skipped} skipped ({total} total)"
251 print(
"OVERALL: FAILED")
255 print(
"OVERALL: PASSED")