|
Option C Tools
|
Functions | |
| LinterContext | _make_ctx (Path project) |
| test_index_populates_both_sets (Path tmp_path) | |
| test_index_is_cached (Path tmp_path) | |
| test_check_tests_exist_uses_index (Path tmp_path) | |
| test_missing_tests_dir_yields_empty_index (Path tmp_path) | |
Purpose
-------
OI-510 / FS-516 regression coverage — :func:`build_test_index` must
walk ``tests_dir`` exactly once per linter run and produce two lookup
sets on :class:`LinterContext`. :func:`check_tests_exist` then becomes
O(1) per call, replacing the previous O(N·M) rglob-and-read loop that
dominated ``oct lint`` runtime on medium-to-large projects.
Responsibilities
----------------
- Verify first call builds and caches ``ctx.test_index``; subsequent
calls return the cached dict without re-walking.
- Verify both naming-convention and import-statement paths populate the
index.
- Verify ``check_tests_exist`` returns True for either lookup path.
Diagnostics
-----------
Domain: LINTER-TESTS
Levels:
L2 — test lifecycle
L3 — assertion details
L4 — deep tracing
Contracts
---------
- First call builds and caches ``ctx.test_index``; subsequent calls
return the cached dict without re-walking.
- Both naming-convention and import-statement paths populate the index.
- ``check_tests_exist`` returns True for either path.
|
protected |
| tests_linter.test_test_file_index.test_check_tests_exist_uses_index | ( | Path | tmp_path | ) |
OI-510: check_tests_exist returns True via either path, False otherwise.
Definition at line 89 of file test_test_file_index.py.
| tests_linter.test_test_file_index.test_index_is_cached | ( | Path | tmp_path | ) |
OI-510: the index is built on first call and reused thereafter.
Definition at line 76 of file test_test_file_index.py.
| tests_linter.test_test_file_index.test_index_populates_both_sets | ( | Path | tmp_path | ) |
OI-510: name-matched and import-matched stems both land in the index.
Definition at line 61 of file test_test_file_index.py.
| tests_linter.test_test_file_index.test_missing_tests_dir_yields_empty_index | ( | Path | tmp_path | ) |
OI-510: absent tests/ folder → empty sets, no exception.
Definition at line 102 of file test_test_file_index.py.