|
Option C Tools
|
Functions | |
| list[Path] | _seed_backups (Path archive_dir, str source_name, int count, float start_age=100.0) |
| None | test_archive_keeps_most_recent_n (Path tmp_path) |
| None | test_archive_prune_handles_empty_dir (Path tmp_path) |
| None | test_archive_prune_respects_per_file_scoping (Path tmp_path) |
| None | test_archive_prune_max_backups_zero_disables (Path tmp_path) |
| None | test_archive_prune_handles_unlink_failure (Path tmp_path, monkeypatch) |
| None | test_default_max_backups_constant () |
| Path | _mk_sized_backup (Path archive_dir, str name, int size, float mtime_offset) |
| None | test_size_prune_evicts_oldest_until_under_cap (Path tmp_path) |
| None | test_size_prune_noop_when_under_cap (Path tmp_path) |
| None | test_size_prune_disabled_with_nonpositive_cap (Path tmp_path) |
| None | test_archive_file_enforces_size_cap_end_to_end (Path tmp_path) |
| None | test_default_max_archive_bytes_constant () |
Variables | |
| name = fail_name: | |
Purpose ------- Validate the OI-424 formatter backup archive rotation in ``oct.formatter.oct_format``. Responsibilities ---------------- - Confirm ``_archive_file`` trims old backups to the configured cap. - Confirm pruning is scoped to the source file (other files untouched). - Confirm ``max_backups == 0`` disables pruning. - Confirm a per-file unlink failure is swallowed. - Confirm ``FormatterContext.max_backups_per_file`` is threaded through to the archiver in the write path. Diagnostics ----------- Domain: TESTS.FORMATTER L2: test lifecycle L3: fixture creation, assertion details L4: deep tracing of archive operations Contracts --------- Inputs: tmp_path pytest fixture Outputs: pass/fail assertions
|
protected |
Create a ``.bak`` of given size with an offset mtime (seconds).
Definition at line 161 of file test_archive_rotation.py.
|
protected |
Create ``count`` fake backups with staggered mtimes (oldest first). Returns the list of created paths in the order they were created.
Definition at line 48 of file test_archive_rotation.py.
| None tests_formatter.test_archive_rotation.test_archive_file_enforces_size_cap_end_to_end | ( | Path | tmp_path | ) |
OI-516: ``_archive_file`` triggers size pruning after writing the backup.
Definition at line 204 of file test_archive_rotation.py.
| None tests_formatter.test_archive_rotation.test_archive_keeps_most_recent_n | ( | Path | tmp_path | ) |
Archiving into a dir with 15 backups prunes to ``max_backups``.
Definition at line 69 of file test_archive_rotation.py.
| None tests_formatter.test_archive_rotation.test_archive_prune_handles_empty_dir | ( | Path | tmp_path | ) |
A fresh archive dir retains exactly one backup after archival.
Definition at line 89 of file test_archive_rotation.py.
| None tests_formatter.test_archive_rotation.test_archive_prune_handles_unlink_failure | ( | Path | tmp_path, |
| monkeypatch ) |
A single ``OSError`` during unlink must not stop pruning the rest.
Definition at line 127 of file test_archive_rotation.py.
| None tests_formatter.test_archive_rotation.test_archive_prune_max_backups_zero_disables | ( | Path | tmp_path | ) |
``max_backups=0`` preserves every existing backup.
Definition at line 116 of file test_archive_rotation.py.
| None tests_formatter.test_archive_rotation.test_archive_prune_respects_per_file_scoping | ( | Path | tmp_path | ) |
Pruning ``foo.py`` must not delete ``bar.py`` backups.
Definition at line 100 of file test_archive_rotation.py.
| None tests_formatter.test_archive_rotation.test_default_max_archive_bytes_constant | ( | ) |
OI-516: default aggregate cap is 5 MiB.
Definition at line 222 of file test_archive_rotation.py.
| None tests_formatter.test_archive_rotation.test_default_max_backups_constant | ( | ) |
Sanity check on the documented default.
Definition at line 151 of file test_archive_rotation.py.
| None tests_formatter.test_archive_rotation.test_size_prune_disabled_with_nonpositive_cap | ( | Path | tmp_path | ) |
OI-516: ``max_total_bytes <= 0`` disables size pruning entirely.
Definition at line 195 of file test_archive_rotation.py.
| None tests_formatter.test_archive_rotation.test_size_prune_evicts_oldest_until_under_cap | ( | Path | tmp_path | ) |
OI-516: aggregate size cap evicts oldest-first.
Definition at line 173 of file test_archive_rotation.py.
| None tests_formatter.test_archive_rotation.test_size_prune_noop_when_under_cap | ( | Path | tmp_path | ) |
OI-516: already under cap → nothing removed.
Definition at line 187 of file test_archive_rotation.py.
| tests_formatter.test_archive_rotation.name = fail_name: |
Definition at line 139 of file test_archive_rotation.py.