|
Option C Tools
|
Functions | |
| Path | _write_config (Path root, dict data) |
| test_dry_run_does_not_write_or_backup (tmp_path) | |
| test_write_creates_backup_with_original_text (tmp_path) | |
| test_restore_config_round_trips_backup (tmp_path) | |
| test_restore_config_without_backup_raises (tmp_path) | |
| test_backup_is_overwritten_with_pre_edit_text_on_second_write (tmp_path) | |
| test_cli_set_level_dry_run_does_not_touch_files (tmp_path, monkeypatch) | |
| test_cli_restore_command_round_trips (tmp_path, monkeypatch) | |
Variables | |
| dict | _V2_CONFIG |
Purpose
-------
OI-528 regression coverage — :func:`oct.diag.oct_diag.set_level` and the
paired :func:`restore_config` helper must provide safe in-place edits of
``debug_config.json``. A bad level write can brick diagnostics, so the
operation is backed by a ``<path>.bk`` sidecar and a ``--dry-run`` flag
that short-circuits both writes.
Responsibilities
----------------
- ``--dry-run`` never writes to the config or creates ``.bk``.
- A real write creates ``<path>.bk`` containing the original text.
- :func:`restore_config` round-trips the backup back onto the config.
- Calling :func:`restore_config` with no backup raises cleanly.
- Re-running ``set_level`` overwrites ``.bk`` with the pre-edit text.
Diagnostics
-----------
Domain: DIAG-TESTS
Levels:
L2 — test lifecycle
L3 — assertion details
L4 — deep tracing
Contracts
---------
- All config writes and backups use ``tmp_path``; no real
``debug_config.json`` is modified.
|
protected |
| tests_diag.test_set_level_safety.test_backup_is_overwritten_with_pre_edit_text_on_second_write | ( | tmp_path | ) |
| tests_diag.test_set_level_safety.test_cli_restore_command_round_trips | ( | tmp_path, | |
| monkeypatch ) |
| tests_diag.test_set_level_safety.test_cli_set_level_dry_run_does_not_touch_files | ( | tmp_path, | |
| monkeypatch ) |
| tests_diag.test_set_level_safety.test_dry_run_does_not_write_or_backup | ( | tmp_path | ) |
| tests_diag.test_set_level_safety.test_restore_config_round_trips_backup | ( | tmp_path | ) |
| tests_diag.test_set_level_safety.test_restore_config_without_backup_raises | ( | tmp_path | ) |
| tests_diag.test_set_level_safety.test_write_creates_backup_with_original_text | ( | tmp_path | ) |
|
protected |
Definition at line 48 of file test_set_level_safety.py.