Orchestrata Ultimate › Tests › Reference › refactor › codemod
Tests reference — tests/refactor/codemod
tests/refactor/codemod — 49 test modules, 1003 test functions (cumulative over subdirectories). Source tree: tests/refactor/codemod at commit 8a2cb42ad. Generated from the tests AST snapshot by scripts/gen-data-pages.py.
Prose pending.
Subdirectories
| Directory | Modules | Tests |
|---|---|---|
_corpus/ |
1 | 0 |
analysis/ |
12 | 50 |
Modules
| Module | Tests | Covers |
|---|---|---|
_benchmark_helpers.py |
0 | 1 |
conftest.py |
0 | 1 |
test_analysis_passes.py |
53 | 3 |
test_benchmark_load.py |
22 | 1 |
test_cig_builder_ast.py |
36 | 4 |
test_cli.py |
21 | 3 |
test_client_coverage.py |
8 | 3 |
test_code_intelligence_graph.py |
38 | 3 |
test_concurrency.py |
11 | 3 |
test_csr_index.py |
15 | 1 |
test_daemon_coverage.py |
5 | 2 |
test_daemon_entry_coverage.py |
13 | 2 |
test_daemon_lifecycle.py |
60 | 2 |
test_docstring_sweep_scope.py |
17 | 3 |
test_fast_fallback_coverage.py |
26 | 1 |
test_file_watching.py |
35 | 1 |
test_ipc_protocol.py |
86 | 4 |
test_observability.py |
74 | 12 |
test_observability_wiring.py |
20 | 8 |
test_parse_cache.py |
17 | 3 |
test_persistence_package.py |
2 | 1 |
test_persistence_repository_coverage.py |
15 | 5 |
test_review_catalogue.py |
9 | 3 |
test_review_checks.py |
39 | 8 |
test_review_coverage.py |
11 | 5 |
test_review_engine.py |
31 | 8 |
test_review_engine_commit_wiring.py |
12 | 8 |
test_review_passes.py |
88 | 4 |
test_server_coverage.py |
14 | 2 |
test_transactional_writeback.py |
21 | 9 |
test_transform_passes.py |
89 | 4 |
test_watcher_coverage.py |
9 | 1 |
test_workspace_index.py |
15 | 2 |
test_workspace_load.py |
38 | 6 |
test_workspace_perf.py |
3 | 1 |
Module details
tests/refactor/codemod/_benchmark_helpers.py
source · 0 tests · 127 lines
Shared helpers for the SPEC-110 workspace-load fixture-based benchmarks.
Covers: refactor.codemod.workspace
tests/refactor/codemod/conftest.py
source · 0 tests · 185 lines
Shared fixtures and BDD step definitions for SPEC-110 codemod tests.
Covers: refactor.codemod.workspace
tests/refactor/codemod/test_analysis_passes.py
source · 53 tests · 680 lines
Tests for SPEC-110 analysis passes — CodeIntelligenceGraph queries.
Covers: refactor.codemod._cig, refactor.codemod._csr_index, refactor.codemod._types
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestBlastRadius |
109 | |
| method | TestBlastRadius.test_single_node |
110 | |
| method | TestBlastRadius.test_chain_hops_1 |
117 | |
| method | TestBlastRadius.test_chain_hops_3 |
123 | |
| method | TestBlastRadius.test_impact_score |
130 | |
| method | TestBlastRadius.test_affected_files |
136 | |
| method | TestBlastRadius.test_disconnected_node |
143 | |
| method | TestBlastRadius.test_zero_hops |
153 | |
| class | TestBreakingChanges |
165 | |
| method | TestBreakingChanges.test_no_entity_id |
166 | |
| method | TestBreakingChanges.test_with_consumers |
172 | |
| method | TestBreakingChanges.test_no_consumers |
190 | |
| method | TestBreakingChanges.test_breaking_change_fields |
197 | |
| class | TestCouplingScore |
217 | |
| method | TestCouplingScore.test_no_edges |
218 | |
| method | TestCouplingScore.test_only_outgoing |
226 | |
| method | TestCouplingScore.test_only_incoming |
242 | |
| method | TestCouplingScore.test_balanced |
254 | |
| class | TestAbstractionLevel |
276 | |
| method | TestAbstractionLevel.test_all_concrete |
277 | |
| method | TestAbstractionLevel.test_all_abstract |
293 | |
| method | TestAbstractionLevel.test_mixed |
309 | |
| method | TestAbstractionLevel.test_no_classes |
325 | |
| method | TestAbstractionLevel.test_no_defined_children |
337 | |
| class | TestCycles |
351 | |
| method | TestCycles.test_no_cycles |
352 | |
| method | TestCycles.test_simple_cycle |
357 | |
| method | TestCycles.test_triangle_cycle |
371 | |
| method | TestCycles.test_self_loop_not_reported |
387 | |
| class | TestTopologicalOrder |
400 | |
| method | TestTopologicalOrder.test_chain |
401 | |
| method | TestTopologicalOrder.test_dag |
406 | |
| method | TestTopologicalOrder.test_single_node |
420 | |
| class | TestAffectedTests |
432 | |
| method | TestAffectedTests.test_with_tested_by_edges |
433 | |
| method | TestAffectedTests.test_no_tested_by_edges |
448 | |
| method | TestAffectedTests.test_empty_function_ids |
453 | |
| method | TestAffectedTests.test_multiple_functions |
458 | |
| class | TestDependencyPath |
480 | |
| method | TestDependencyPath.test_direct_path |
481 | |
| method | TestDependencyPath.test_same_node |
488 | |
| method | TestDependencyPath.test_no_path |
493 | |
| method | TestDependencyPath.test_shortest_path |
502 | |
| class | TestCentrality |
526 | |
| method | TestCentrality.test_chain_centrality |
527 | |
| method | TestCentrality.test_centrality_defaults_to_the_exact_computation |
534 | The default must not be the sampled estimate. |
| method | TestCentrality.test_sampled_centrality_diverges_from_exact |
546 | Sampling is lossy — hold the evidence that it is not equivalent. |
| method | TestCentrality.test_exact_centrality_is_cached_per_instance |
559 | |
| method | TestCentrality.test_top_k_limits |
568 | |
| method | TestCentrality.test_single_node |
573 | |
| method | TestCentrality.test_exact_flag_matches_default_on_small_graph |
580 | n <= samples: default path is already exact, flag is a no-op. |
| method | TestCentrality.test_approximate_top20_overlap_vs_exact |
585 | D2b gate: pivot-sampled top-20 overlaps exact >= 90%. |
| class | TestPagerankScore |
599 | |
| method | TestPagerankScore.test_hub_node |
600 | |
| method | TestPagerankScore.test_isolated_node |
617 | |
| method | TestPagerankScore.test_empty_graph |
623 | |
| method | TestPagerankScore.test_rank_vector_memoized_per_instance |
629 | D2: rank vector computed once, later calls are dict lookups (~0ms). |
| class | TestCIGProperties |
652 | |
| method | TestCIGProperties.test_node_count |
653 | |
| method | TestCIGProperties.test_resolve |
657 | |
| method | TestCIGProperties.test_node_key |
662 | |
| method | TestCIGProperties.test_node_key_unknown |
667 | |
| method | TestCIGProperties.test_dependencies |
672 | |
| method | TestCIGProperties.test_dependents |
677 |
tests/refactor/codemod/test_benchmark_load.py
source · 22 tests · 206 lines
Performance benchmarks for workspace loading.
Covers: refactor.codemod.workspace
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestSerialLoad |
76 | |
| method | TestSerialLoad.test_serial_load_completes |
77 | |
| method | TestSerialLoad.test_serial_load_time |
81 | |
| method | TestSerialLoad.test_serial_load_file_count |
88 | |
| method | TestSerialLoad.test_serial_load_total_bytes |
92 | |
| method | TestSerialLoad.test_serial_load_no_unparsable |
96 | |
| class | TestParallelLoad |
101 | |
| method | TestParallelLoad.test_parallel_load_completes |
102 | |
| method | TestParallelLoad.test_parallel_load_time |
106 | |
| method | TestParallelLoad.test_parallel_load_file_count |
112 | |
| method | TestParallelLoad.test_parallel_matches_serial_count |
116 | |
| class | TestMemoryUsage |
122 | |
| method | TestMemoryUsage.test_rss_delta_recorded |
123 | |
| method | TestMemoryUsage.test_rss_under_limit |
127 | |
| class | TestLargeFiles |
133 | |
| method | TestLargeFiles.test_large_repo_loads |
134 | |
| method | TestLargeFiles.test_large_repo_no_unparsable |
138 | |
| method | TestLargeFiles.test_large_repo_total_bytes |
142 | |
| class | TestUnparsableFiles |
147 | |
| method | TestUnparsableFiles.test_syntax_error_recorded |
148 | |
| method | TestUnparsableFiles.test_empty_file_parses |
159 | |
| class | TestWorkspaceStats |
168 | |
| method | TestWorkspaceStats.test_stats_fields |
169 | |
| method | TestWorkspaceStats.test_stats_frozen |
178 | |
| class | TestCIGBuildDuringLoad |
185 | |
| method | TestCIGBuildDuringLoad.test_cig_built |
186 | |
| method | TestCIGBuildDuringLoad.test_cig_has_nodes |
190 | |
| method | TestCIGBuildDuringLoad.test_cig_cycles_query |
195 | |
| class | TestRoundTripFidelity |
201 | |
| method | TestRoundTripFidelity.test_code_round_trips |
202 |
tests/refactor/codemod/test_cig_builder_ast.py
source · 36 tests · 580 lines
Tests for the ast-based CIG extractor (_cig_builder_ast.py) — the sole backend.
Covers: core.base.traces, refactor.codemod._cig_builder_ast, refactor.codemod._types, refactor.codemod.workspace
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestAstExtractorStructure |
114 | build_cig_ast produces a well-formed graph with the expected keys. |
| method | TestAstExtractorStructure.test_rich_module_structure |
117 | |
| method | TestAstExtractorStructure.test_properties_populated |
134 | |
| method | TestAstExtractorStructure.test_test_file_detection |
150 | |
| method | TestAstExtractorStructure.test_multi_module_edges |
163 | |
| method | TestAstExtractorStructure.test_parallel_identical_to_serial |
180 | |
| method | TestAstExtractorStructure.test_single_module_parallel_falls_back_to_serial |
194 | |
| method | TestAstExtractorStructure.test_syntax_error_module_skipped_with_module_node_absent |
200 | |
| method | TestAstExtractorStructure.test_complex_annotation_uses_unparse |
210 | |
| method | TestAstExtractorStructure.test_bool_and_none_defaults_resolved |
220 | |
| class | TestExtractHelpers |
239 | Name/annotation extraction edge cases. |
| method | TestExtractHelpers.test_extract_name_none |
242 | |
| method | TestExtractHelpers.test_extract_dotted_name_none |
245 | |
| method | TestExtractHelpers.test_extract_annotation_none |
248 | |
| method | TestExtractHelpers.test_extract_call_name_from_attribute |
251 | |
| method | TestExtractHelpers.test_extract_call_name_non_name_returns_none |
259 | |
| class | TestWorkspaceLoadAstBackend |
268 | CodemodWorkspace.load() integration — the ast backend is the only one. |
| method | TestWorkspaceLoadAstBackend.test_ast_backend_loads_fixture_package |
271 | |
| method | TestWorkspaceLoadAstBackend.test_ast_backend_parallel |
292 | |
| method | TestWorkspaceLoadAstBackend.test_ast_backend_with_cache |
305 | |
| method | TestWorkspaceLoadAstBackend.test_unknown_include_dir_yields_empty_forest |
315 | A nonexistent include root is skipped, not an error (matches the |
| method | TestWorkspaceLoadAstBackend.test_node_ids_follow_sorted_file_order |
324 | load sorts the file list: ids do not depend on rglob order. |
| class | TestImportResolution |
354 | IMPORTS edges resolve in a second pass over the finished module table. |
| method | TestImportResolution.test_src_layout_dotted_name_resolves_through_the_include_root |
357 | |
| method | TestImportResolution.test_importer_sorting_before_importee_still_resolves |
369 | |
| method | TestImportResolution.test_relative_imports_resolve_by_level |
380 | |
| method | TestImportResolution.test_package_import_resolves_to_its_init_and_submodule_wins |
395 | |
| method | TestImportResolution.test_external_self_and_overshooting_imports_make_no_edge |
409 | |
| method | TestImportResolution.test_overshooting_relative_import_does_not_bind_past_the_top_package |
424 | |
| method | TestImportResolution.test_relative_climb_into_an_enclosing_package_still_binds |
434 | |
| method | TestImportResolution.test_stdlib_name_never_binds_to_a_same_named_repo_file |
443 | |
| method | TestImportResolution.test_package_importer_does_not_bind_into_scripts_or_tests_by_bare_name |
453 | |
| method | TestImportResolution.test_from_import_prefers_an_earlier_roots_package_over_a_later_submodule |
470 | |
| method | TestImportResolution.test_script_directory_is_an_import_root_for_bare_names |
481 | |
| method | TestImportResolution.test_import_nodes_carry_the_real_line_and_resolved_module |
490 | |
| method | TestImportResolution.test_key_addressed_sinks_resolve_through_a_replayed_op_log |
505 | sink_edge_to_key / sink_edge_from_key (TESTED_BY plumbing). |
| method | TestImportResolution.test_one_edge_per_module_pair |
520 | |
| class | TestLazySources |
548 | Text is read only for a module with no pre-parsed tree (REQ-110-004). |
| method | TestLazySources.test_pre_parsed_trees_never_read_the_text |
556 | |
| method | TestLazySources.test_a_path_without_a_tree_falls_back_to_its_text |
564 | |
| method | TestLazySources.test_forest_sources_decode_the_forest_on_access |
572 |
tests/refactor/codemod/test_cli.py
source · 21 tests · 258 lines
BDD + pytest tests for CLI subcommands.
Covers: refactor.codemod.passes, refactor.codemod.report, refactor.codemod.workspace
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestWorkspaceLoadForCLI |
35 | |
| method | TestWorkspaceLoadForCLI.test_load_workspace |
36 | |
| method | TestWorkspaceLoadForCLI.test_load_workspace_parallel |
41 | |
| method | TestWorkspaceLoadForCLI.test_load_bench_metrics |
45 | |
| class | TestRunPassDryRun |
60 | |
| method | TestRunPassDryRun.test_replace_string_dry_run |
61 | |
| method | TestRunPassDryRun.test_replace_string_apply |
75 | |
| class | TestReport |
94 | |
| method | TestReport.test_commit_report_json_serialization |
95 | |
| method | TestReport.test_commit_report_empty_findings |
123 | |
| method | TestReport.test_commit_report_error_finding_aborts |
134 | |
| class | TestAnalyze |
164 | |
| method | TestAnalyze.test_query_dependencies |
165 | |
| method | TestAnalyze.test_query_dependents |
172 | |
| method | TestAnalyze.test_cig_query_cycles |
179 | |
| method | TestAnalyze.test_cig_topological_order |
184 | |
| method | TestAnalyze.test_cig_centrality |
189 | |
| class | TestChangeSet |
195 | |
| method | TestChangeSet.test_changeset_merge |
196 | |
| method | TestChangeSet.test_changeset_len |
209 | |
| method | TestChangeSet.test_changeset_iter |
213 | |
| method | TestChangeSet.test_changeset_paths |
217 | |
| method | TestChangeSet.test_changeset_file_count |
221 | |
| class | TestFinding |
226 | |
| method | TestFinding.test_finding_error |
227 | |
| method | TestFinding.test_finding_warning |
238 | |
| method | TestFinding.test_finding_with_proof_tree |
249 |
tests/refactor/codemod/test_client_coverage.py
source · 8 tests · 233 lines
Coverage tests for CodemodClient error branches (SPEC-110, REQ-110-139/140).
Covers: refactor.codemod.client, refactor.codemod.server, refactor.codemod.workspace
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestQueryDependentsSuccess |
60 | Line 114: the success return of query_dependents (only the error |
| method | TestQueryDependentsSuccess.test_query_dependents_returns_node_ids |
93 | |
| method | TestQueryDependentsSuccess.test_query_dependents_of_imported_module_is_nonempty |
106 | mod_a is imported by mod_b, so mod_a must have a dependent. |
| class | TestCloseErrorBranch |
119 | |
| method | TestCloseErrorBranch.test_close_logs_warning_when_socket_close_fails |
120 | |
| class | TestCallSendFailure |
137 | |
| method | TestCallSendFailure.test_sendall_oserror_raises_connection_error |
138 | Sending on a closed socket raises OSError -> ConnectionError. |
| class | TestRecvResponseBranches |
154 | |
| method | TestRecvResponseBranches.test_malformed_lines_are_skipped_and_valid_response_returned |
155 | Garbage lines (bad UTF-8, bad JSON) must not break the read loop: |
| method | TestRecvResponseBranches.test_socket_closed_while_waiting_raises_connection_error |
182 | If _socket becomes None while _recv_response still has buffered |
| method | TestRecvResponseBranches.test_recv_oserror_raises_connection_error |
200 | A recv() OSError (here a real read timeout on a silent peer) |
| method | TestRecvResponseBranches.test_peer_orderly_shutdown_raises_daemon_closed |
218 | Peer half-closes its write side: recv() returns b'' — the client |
tests/refactor/codemod/test_code_intelligence_graph.py
source · 38 tests · 702 lines
Tests for CodeIntelligenceGraph — multihop graph queries.
Covers: core.base.traces, refactor.codemod._types, refactor.codemod.workspace
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestCIGNodes |
23 | REQ-110-022: CIG contains nodes for all code entities. |
| method | TestCIGNodes.test_module_nodes |
26 | CIG contains Module nodes for each file. |
| method | TestCIGNodes.test_class_nodes |
40 | CIG contains Class nodes for each class definition. |
| method | TestCIGNodes.test_function_nodes |
54 | CIG contains Function nodes for each function definition. |
| method | TestCIGNodes.test_method_nodes |
67 | CIG contains Method nodes for methods inside classes. |
| class | TestCIGEdges |
82 | REQ-110-022: CIG contains edges for all relationships. |
| method | TestCIGEdges.test_defines_edges |
85 | Module DEFINES Class and Function edges. |
| method | TestCIGEdges.test_imports_edges |
97 | IMPORTS edges between modules. |
| class | TestCIGDependencies |
112 | REQ-110-023: dependencies() and dependents() O(1) via CSR. |
| method | TestCIGDependencies.test_dependencies_returns_list |
115 | dependencies() returns a list of node IDs. |
| method | TestCIGDependencies.test_dependents_returns_list |
129 | dependents() returns a list of node IDs. |
| method | TestCIGDependencies.test_dependencies_performance |
144 | dependencies() over every node completes in under 1ms of CPU. |
| class | TestCIGBlastRadius |
175 | REQ-110-023: blast_radius() BFS transitive closure. |
| method | TestCIGBlastRadius.test_blast_radius_includes_self |
178 | blast_radius() includes the starting node. |
| method | TestCIGBlastRadius.test_blast_radius_returns_files |
192 | blast_radius() returns affected file paths. |
| method | TestCIGBlastRadius.test_blast_radius_impact_score |
206 | blast_radius() returns impact score between 0 and 1. |
| class | TestCIGCycles |
222 | REQ-110-023: cycles() Tarjan's SCC. |
| method | TestCIGCycles.test_no_cycles |
225 | No cycles in acyclic graph. |
| method | TestCIGCycles.test_cycles_returns_list |
238 | cycles() returns a list of lists. |
| class | TestCIGTopologicalOrder |
252 | REQ-110-023: topological_order() Kahn's algorithm. |
| method | TestCIGTopologicalOrder.test_topological_order_returns_list |
255 | topological_order() returns a list of node IDs. |
| method | TestCIGTopologicalOrder.test_topological_order_includes_all_nodes |
267 | topological_order() includes all reachable nodes. |
| class | TestCIGAffectedTests |
282 | REQ-110-023: affected_tests() reverse TESTED_BY edges. |
| method | TestCIGAffectedTests.test_affected_tests_empty_input |
285 | affected_tests() with empty input returns empty set. |
| method | TestCIGAffectedTests.test_affected_tests_returns_frozenset |
297 | affected_tests() returns a frozenset. |
| class | TestCIGCouplingScore |
311 | REQ-110-023: coupling_score() efferent/afferent + instability. |
| method | TestCIGCouplingScore.test_coupling_score_structure |
314 | coupling_score() returns CouplingScore with correct fields. |
| method | TestCIGCouplingScore.test_coupling_score_isolated_node |
330 | Isolated node has zero coupling. |
| class | TestCIGAbstractionLevel |
347 | REQ-110-023: abstraction_level() Protocol/ABC ratio. |
| method | TestCIGAbstractionLevel.test_abstraction_level_structure |
350 | abstraction_level() returns AbstractionLevel with correct fields. |
| class | TestCIGCentrality |
369 | REQ-110-023: centrality() betweenness centrality. |
| method | TestCIGCentrality.test_centrality_returns_ranked_list |
372 | centrality() returns list of (node_id, score) tuples. |
| class | TestCIGPagerankScore |
392 | REQ-110-023: pagerank_score() PageRank-style importance. |
| method | TestCIGPagerankScore.test_pagerank_score_range |
395 | pagerank_score() returns value between 0 and 1. |
| class | TestCIGBreakingChanges |
411 | REQ-110-023: breaking_changes() signature diff. |
| method | TestCIGBreakingChanges.test_breaking_changes_no_entity |
414 | breaking_changes() with no entity_id returns empty list. |
| class | TestCIGDependencyPath |
429 | REQ-110-023: dependency_path() shortest path. |
| method | TestCIGDependencyPath.test_dependency_path_self |
432 | dependency_path() to self returns [self]. |
| method | TestCIGDependencyPath.test_dependency_path_unreachable |
446 | dependency_path() to unreachable node returns None. |
| class | TestCIGQueryPerformance |
464 | REQ-110-024: All CIG queries complete in under 2 milliseconds. |
| method | TestCIGQueryPerformance.test_query_performance |
468 | All CIG queries complete in under 2ms of CPU each. |
| class | TestCIGBuilderEdgeTypes |
513 | Test CIG builder extracts all edge types correctly. |
| method | TestCIGBuilderEdgeTypes.test_class_with_base |
516 | CIG builder extracts class with base classes. |
| method | TestCIGBuilderEdgeTypes.test_async_function |
539 | CIG builder extracts async functions. |
| method | TestCIGBuilderEdgeTypes.test_decorated_function |
552 | CIG builder extracts decorated functions. |
| method | TestCIGBuilderEdgeTypes.test_import_from |
573 | CIG builder extracts from-import statements. |
| method | TestCIGBuilderEdgeTypes.test_function_with_params |
587 | CIG builder extracts function parameters. |
| method | TestCIGBuilderEdgeTypes.test_function_call |
600 | CIG builder extracts function calls. |
| method | TestCIGBuilderEdgeTypes.test_dataclass |
614 | CIG builder extracts dataclass decorator. |
| class | TestCIGResolveMethods |
635 | Test CIG resolve and node_key methods. |
| method | TestCIGResolveMethods.test_resolve_known_key |
638 | resolve() returns node_id for known key. |
| method | TestCIGResolveMethods.test_node_key_known |
651 | node_key() returns key for known node_id. |
| method | TestCIGResolveMethods.test_node_key_unknown |
665 | node_key() returns placeholder for unknown node_id. |
| class | TestCIGBreakingChangesDetailed |
679 | Detailed breaking_changes() tests. |
| method | TestCIGBreakingChangesDetailed.test_breaking_changes_with_entity |
682 | breaking_changes() with entity_id finds consumers. |
tests/refactor/codemod/test_concurrency.py
source · 11 tests · 224 lines
BDD + pytest tests for concurrent client handling.
Covers: refactor.codemod.client, refactor.codemod.server, refactor.codemod.workspace
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestMultipleClients |
73 | |
| method | TestMultipleClients.test_multiple_clients_connect |
74 | |
| method | TestMultipleClients.test_client_count_tracks_connections |
92 | |
| class | TestParallelReads |
110 | |
| method | TestParallelReads.test_parallel_status_queries |
111 | |
| method | TestParallelReads.test_parallel_query_cycles |
137 | |
| class | TestWriteSerialization |
156 | |
| method | TestWriteSerialization.test_write_lock_exists |
157 | |
| method | TestWriteSerialization.test_write_lock_is_threading_lock |
161 | |
| class | TestClientDisconnection |
166 | |
| method | TestClientDisconnection.test_client_disconnect_detected |
167 | |
| method | TestClientDisconnection.test_abrupt_disconnect |
175 | |
| class | TestStressTest |
183 | |
| method | TestStressTest.test_many_sequential_queries |
184 | |
| method | TestStressTest.test_concurrent_status_queries_with_executor |
195 | |
| class | TestMixedWorkload |
210 | |
| method | TestMixedWorkload.test_read_during_idle |
211 |
tests/refactor/codemod/test_csr_index.py
source · 15 tests · 118 lines
Tests for _CSRIndex — CSR adjacency arrays for O(1) graph queries.
Covers: refactor.codemod._csr_index
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestCSRConstruction |
11 | CSR index construction from edge lists. |
| method | TestCSRConstruction.test_empty_graph |
14 | Empty graph with no nodes or edges. |
| method | TestCSRConstruction.test_single_node_no_edges |
19 | Single node with no edges. |
| method | TestCSRConstruction.test_simple_chain |
26 | A -> B -> C chain. |
| method | TestCSRConstruction.test_star_graph |
33 | Star graph: center node connects to all others. |
| method | TestCSRConstruction.test_self_loop |
41 | Self-loop edge. |
| class | TestCSRForwardLookup |
48 | Forward (dependency) lookups. |
| method | TestCSRForwardLookup.test_multiple_outgoing |
51 | Node with multiple outgoing edges. |
| method | TestCSRForwardLookup.test_out_degree |
56 | Out-degree calculation. |
| class | TestCSRReverseLookup |
65 | Reverse (dependent) lookups. |
| method | TestCSRReverseLookup.test_multiple_incoming |
68 | Node with multiple incoming edges. |
| method | TestCSRReverseLookup.test_in_degree |
73 | In-degree calculation. |
| class | TestCSRTransitiveClosure |
81 | BFS transitive closure. |
| method | TestCSRTransitiveClosure.test_forward_closure |
84 | Forward transitive closure. |
| method | TestCSRTransitiveClosure.test_reverse_closure |
90 | Reverse transitive closure. |
| method | TestCSRTransitiveClosure.test_depth_limit |
96 | Depth-limited transitive closure. |
| method | TestCSRTransitiveClosure.test_disconnected_components |
102 | Disconnected graph components. |
| method | TestCSRTransitiveClosure.test_cycle_in_graph |
108 | Graph with a cycle. |
| method | TestCSRTransitiveClosure.test_empty_closure |
114 | Node with no outgoing edges. |
tests/refactor/codemod/test_daemon_coverage.py
source · 5 tests · 215 lines
Branch-coverage tests for CodemodDaemon (REQ-110-133 through REQ-110-137).
Covers: core.base.traces, refactor.codemod.daemon
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestStopPathReconstruction |
77 | stop() must rebuild daemon paths when only _repo_root is known |
| method | TestStopPathReconstruction.test_stop_with_repo_root_but_unset_pid_file |
81 | |
| method | TestStopPathReconstruction.test_stop_reconstructed_paths_still_clean_up_stale_files |
92 | |
| class | TestSigkillEscalation |
110 | A daemon that ignores SIGTERM must be SIGKILLed after the shutdown |
| method | TestSigkillEscalation.test_stop_sigkills_daemon_ignoring_sigterm |
115 | |
| class | TestCleanupFilesErrorHandling |
158 | _cleanup_files() must log and continue when unlink fails |
| method | TestCleanupFilesErrorHandling.test_cleanup_survives_unlink_permission_error |
162 | |
| class | TestProcessAliveNonChildZombie |
180 | A zombie owned by ANOTHER process cannot be reaped by us: |
| method | TestProcessAliveNonChildZombie.test_non_child_zombie_counts_as_dead |
185 |
tests/refactor/codemod/test_daemon_entry_coverage.py
source · 13 tests · 406 lines
Branch-coverage tests for the codemod daemon entry point (SPEC-110).
Covers: refactor.codemod._daemon_entry, orchestrata_ultimate/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_status_reply_carries_identity_from_unrelated_cwd |
141 | A real daemon subprocess started elsewhere reports who it is (ADR-0067 P1). |
| function | test_read_deployed_commit_parses_version_file |
191 | |
| function | test_read_deployed_commit_rejects_non_hex_and_tolerates_trailing_space |
197 | F7: a ref name is no sha; a trailing-space line still parses. |
| function | test_find_deployed_commit_prefers_code_root_then_prefix |
208 | F1: install-tools.sh stamps <prefix>/VERSION while the code root is |
| function | test_find_deployed_commit_unstamped_code_root_version_falls_through |
221 | |
| function | test_read_deployed_commit_missing_file_is_none |
231 | |
| function | test_read_deployed_commit_without_commit_line_is_none |
235 | |
| function | test_build_identity_fields |
241 | |
| function | test_daemon_main_full_lifecycle |
262 | Happy path: load, serve, inotify reload succeeds, SIGTERM shuts down. |
| function | test_daemon_main_reload_failure_keeps_serving |
292 | _on_file_change exception path: a failed reload is logged, not fatal. |
| function | test_daemon_main_server_error_exits_cleanly |
318 | serve() exception path: blocked socket path is logged and unwound. |
| function | test_main_block_usage_error |
353 | main with wrong argc prints usage to stderr and exits 1. |
| function | test_main_block_runs_daemon |
368 | main with correct argv parses args and runs the full daemon. |
tests/refactor/codemod/test_daemon_lifecycle.py
source · 60 tests · 1045 lines
BDD + pytest tests for CodemodDaemon lifecycle management.
Covers: core.base.traces, refactor.codemod.daemon
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestProcessAlive |
197 | |
| method | TestProcessAlive.test_current_process_is_alive |
198 | |
| method | TestProcessAlive.test_nonexistent_pid_is_dead |
201 | |
| method | TestProcessAlive.test_pid_one_returns_false_due_to_permission |
204 | |
| method | TestProcessAlive.test_zombie_child_counts_as_dead |
207 | An exited-but-unreaped child is a zombie: kill(pid, 0) succeeds |
| class | TestPidIsCodemodDaemon |
227 | The identity predicate guarding every signal on the legacy path. |
| method | TestPidIsCodemodDaemon.test_daemon_shaped_argv_is_a_daemon |
231 | |
| method | TestPidIsCodemodDaemon.test_a_relative_repo_root_argv_resolves_against_the_daemons_cwd |
244 | A hand-started legacy daemon may carry a RELATIVE repo root. It is |
| method | TestPidIsCodemodDaemon.test_an_unreadable_cwd_link_is_fail_safe_not_a_daemon |
273 | A daemon-shaped argv with a RELATIVE repo root whose |
| method | TestPidIsCodemodDaemon.test_an_absolute_root_is_identified_without_the_cwd_link |
287 | An ABSOLUTE argv root needs no cwd: an unreadable cwd link must not |
| method | TestPidIsCodemodDaemon.test_a_daemon_for_a_different_repo_root_is_not_ours |
301 | A codemod daemon serving ANOTHER repo carries the right module but |
| method | TestPidIsCodemodDaemon.test_the_entry_module_name_outside_the_dash_m_slot_is_not_a_daemon |
321 | The module name as a bare argument, or -m followed by anything |
| method | TestPidIsCodemodDaemon.test_an_unrelated_or_dead_pid_is_not_a_daemon |
370 | |
| method | TestPidIsCodemodDaemon.test_the_real_units_main_pid_is_our_daemon_and_this_process_is_not |
379 | Against a REAL started unit: its MainPID (the deployed launcher's |
| class | TestDaemonInit |
398 | |
| method | TestDaemonInit.test_defaults_name_the_installed_prefix_and_unit |
399 | |
| method | TestDaemonInit.test_prefix_and_unit_are_injectable |
405 | |
| method | TestDaemonInit.test_initial_state_is_none |
416 | |
| class | TestDaemonStart |
425 | |
| method | TestDaemonStart.test_start_creates_daemon_dir |
427 | |
| method | TestDaemonStart.test_start_raises_when_already_running |
441 | Unit not loaded: the PID file is the only evidence, and a pid that |
| method | TestDaemonStart.test_start_discards_a_pid_file_naming_an_unrelated_process |
461 | Unit not loaded and the PID file names a live process that is not a |
| method | TestDaemonStart.test_start_replaces_a_stale_pid_file_under_a_loaded_inactive_unit |
480 | The unit-first rule status applies: with the unit loaded but |
| method | TestDaemonStart.test_start_raises_when_the_loaded_unit_is_already_running |
503 | |
| method | TestDaemonStart.test_start_raises_when_lock_held |
518 | |
| method | TestDaemonStart.test_start_refuses_only_under_the_lock |
532 | The already-running refusal (and its stale-PID-file removal side |
| method | TestDaemonStart.test_concurrent_starts_launch_the_unit_once_and_refuse_the_other |
558 | Smoke for the race outcome, NOT the proof of lock ordering: two |
| method | TestDaemonStart.test_start_writes_pid_file |
601 | |
| method | TestDaemonStart.test_start_launches_through_the_systemd_unit |
615 | |
| method | TestDaemonStart.test_start_without_deployment_raises_naming_installer |
631 | |
| method | TestDaemonStart.test_start_failing_unit_raises_with_systemctl_stderr |
659 | A repo with no .git fails the unit's ExecStartPre: start |
| method | TestDaemonStart.test_start_reports_a_launcher_that_dies_before_serving |
674 | A launcher that exits at once is reported as a failed start without |
| class | TestDaemonStop |
702 | |
| method | TestDaemonStop.test_stop_stops_the_unit_and_cleans_up |
703 | |
| method | TestDaemonStop.test_stop_no_repo_root |
719 | |
| method | TestDaemonStop.test_stop_no_pid_file |
723 | |
| method | TestDaemonStop.test_stop_dead_pid_cleans_up |
726 | |
| method | TestDaemonStop.test_stop_sends_sigterm |
737 | |
| method | TestDaemonStop.test_stop_sigkill_on_timeout |
747 | |
| method | TestDaemonStop.test_stop_never_signals_an_unrelated_pid_when_the_unit_is_unloaded |
780 | Legacy path (no loaded unit): a stale PID file whose pid now belongs |
| method | TestDaemonStop.test_stop_never_signals_a_stale_pid_file_pid_when_the_unit_is_loaded |
801 | After a unit restart the PID file is stale and its pid may belong |
| method | TestDaemonStop.test_status_follows_the_unit_main_pid_not_the_pid_file |
819 | |
| method | TestDaemonStop.test_unit_instance_without_systemd_escape_raises_runtime_error |
833 | A missing systemd-escape is a RuntimeError (which --auto-start |
| method | TestDaemonStop.test_stop_handles_process_lookup_error |
859 | |
| method | TestDaemonStop.test_stop_cleans_up_socket_and_lock |
864 | |
| class | TestDaemonStatus |
882 | |
| method | TestDaemonStatus.test_status_no_repo_root |
883 | |
| method | TestDaemonStatus.test_status_not_running |
890 | |
| method | TestDaemonStatus.test_status_running |
895 | |
| method | TestDaemonStatus.test_status_reports_unit_and_deployment_identity |
913 | |
| method | TestDaemonStatus.test_status_before_start_reports_inactive_unit |
937 | |
| method | TestDaemonStatus.test_status_identity_when_nothing_is_deployed |
944 | |
| method | TestDaemonStatus.test_status_with_repo_root_but_no_pid_file |
955 | |
| class | TestDaemonRestart |
961 | |
| method | TestDaemonRestart.test_restart_no_repo_root |
962 | |
| method | TestDaemonRestart.test_restart_stops_and_starts |
967 | |
| class | TestDaemonPidManagement |
986 | |
| method | TestDaemonPidManagement.test_read_pid_no_file |
987 | |
| method | TestDaemonPidManagement.test_read_pid_valid |
990 | |
| method | TestDaemonPidManagement.test_read_pid_invalid_content |
995 | |
| method | TestDaemonPidManagement.test_write_pid |
1000 | |
| method | TestDaemonPidManagement.test_write_pid_none_file |
1005 | |
| class | TestDaemonLocking |
1010 | |
| method | TestDaemonLocking.test_acquire_lock_success |
1011 | |
| method | TestDaemonLocking.test_acquire_lock_none_file |
1016 | |
| method | TestDaemonLocking.test_release_lock_invalid_fd |
1020 | |
| class | TestDaemonCleanup |
1024 | |
| method | TestDaemonCleanup.test_cleanup_removes_files |
1025 | |
| method | TestDaemonCleanup.test_cleanup_handles_missing_files |
1040 | |
| method | TestDaemonCleanup.test_cleanup_none_paths |
1043 |
tests/refactor/codemod/test_docstring_sweep_scope.py
source · 17 tests · 352 lines
DocstringSweepPass sweeps docstrings and comments, and nothing else (REQ-110-010).
Covers: core.base.traces, refactor.codemod.passes, refactor.ctok/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_module_class_function_async_and_nested_docstrings_are_rewritten |
57 | |
| function | test_a_string_that_is_code_keeps_its_exact_bytes |
86 | |
| function | test_a_module_of_only_code_strings_is_left_alone |
102 | |
| function | test_a_raw_docstring_stays_raw_with_its_backslash_intact |
109 | |
| function | test_a_u_prefixed_docstring_keeps_its_prefix |
118 | |
| function | test_escaped_quotes_and_single_quoted_triple_docstrings_round_trip |
125 | |
| function | test_comments_are_still_rewritten |
141 | |
| function | test_an_implicitly_concatenated_docstring_is_left_alone |
150 | |
| function | test_a_no_op_sweep_over_the_tools_tree_produces_no_entries |
206 | |
| function | test_a_sweep_over_the_tools_tree_changes_only_docstring_and_comment_lines |
218 | |
| function | test_a_replacement_carrying_the_triple_delimiter_leaves_the_docstring |
277 | |
| function | test_a_replacement_carrying_the_single_delimiter_leaves_the_docstring |
289 | |
| function | test_a_replacement_ending_in_an_odd_backslash_run_leaves_the_docstring |
295 | |
| function | test_a_replacement_with_a_quote_that_is_not_the_delimiter_is_applied |
301 | |
| function | test_a_raw_newline_leaves_a_single_quoted_docstring_and_enters_a_triple_one |
314 | |
| function | test_a_sweep_that_makes_a_malformed_escape_leaves_the_docstring |
331 | |
| function | test_a_legitimate_escape_in_a_replacement_is_applied |
345 |
tests/refactor/codemod/test_fast_fallback_coverage.py
source · 26 tests · 213 lines
Coverage tests for the pure-Python codemod_fast fallback API.
Covers: refactor.codemod._fast_fallback
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestCsrBuild |
32 | |
| method | TestCsrBuild.test_empty_graph_zero_nodes |
33 | |
| method | TestCsrBuild.test_nodes_without_edges |
41 | |
| method | TestCsrBuild.test_single_edge |
46 | |
| method | TestCsrBuild.test_fan_out_groups_neighbors_by_source |
51 | |
| method | TestCsrBuild.test_offsets_monotonic_and_self_loop |
60 | |
| class | TestCsrDependencies |
77 | |
| method | TestCsrDependencies.test_node_with_edges |
78 | |
| method | TestCsrDependencies.test_boundary_last_node_is_sink |
83 | |
| method | TestCsrDependencies.test_first_node_single_outgoing |
87 | |
| class | TestCsrDependents |
93 | |
| method | TestCsrDependents.test_transpose_reverse_lookup |
94 | |
| method | TestCsrDependents.test_source_node_has_no_dependents |
101 | |
| class | TestCsrBfs |
113 | |
| method | TestCsrBfs.test_isolated_start_node |
114 | |
| method | TestCsrBfs.test_unlimited_reaches_full_chain |
118 | |
| method | TestCsrBfs.test_unreachable_nodes_excluded |
124 | |
| method | TestCsrBfs.test_max_depth_zero_returns_start_only |
129 | |
| method | TestCsrBfs.test_max_depth_one_returns_direct_neighbors |
133 | |
| method | TestCsrBfs.test_max_depth_two |
137 | |
| method | TestCsrBfs.test_cycle_visits_each_node_once |
141 | |
| method | TestCsrBfs.test_diamond_dedupes_shared_successor |
146 | |
| method | TestCsrBfs.test_back_edge_to_visited_start |
152 | |
| class | TestXxhash3_64 |
164 | |
| method | TestXxhash3_64.test_pinned_digests |
173 | |
| method | TestXxhash3_64.test_digest_shape |
176 | |
| method | TestXxhash3_64.test_binary_input |
181 | |
| class | TestMmapLoad |
193 | |
| method | TestMmapLoad.test_round_trip_via_path |
194 | |
| method | TestMmapLoad.test_accepts_str_path |
200 | |
| method | TestMmapLoad.test_empty_file |
206 | |
| method | TestMmapLoad.test_missing_file_raises |
210 |
tests/refactor/codemod/test_file_watching.py
source · 35 tests · 313 lines
BDD + pytest tests for inotify file watching.
Covers: refactor.codemod.watcher
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestInotifyConstants |
52 | |
| method | TestInotifyConstants.test_in_modify |
53 | |
| method | TestInotifyConstants.test_in_create |
56 | |
| method | TestInotifyConstants.test_in_delete |
59 | |
| method | TestInotifyConstants.test_in_moved_from |
62 | |
| method | TestInotifyConstants.test_in_moved_to |
65 | |
| method | TestInotifyConstants.test_in_close_write |
68 | |
| method | TestInotifyConstants.test_in_mask_combines_all |
71 | |
| method | TestInotifyConstants.test_event_struct_format |
82 | |
| method | TestInotifyConstants.test_event_size |
85 | |
| class | TestLoadInotify |
89 | |
| method | TestLoadInotify.test_load_inotify_returns_libc |
90 | |
| method | TestLoadInotify.test_load_inotify_has_inotify_init |
94 | |
| method | TestLoadInotify.test_load_inotify_has_inotify_add_watch |
98 | |
| method | TestLoadInotify.test_load_inotify_has_inotify_rm_watch |
102 | |
| class | TestWalkPythonDirs |
107 | |
| method | TestWalkPythonDirs.test_finds_python_dirs |
108 | |
| method | TestWalkPythonDirs.test_skips_git_dir |
113 | |
| method | TestWalkPythonDirs.test_skips_pycache |
120 | |
| method | TestWalkPythonDirs.test_skips_venv |
127 | |
| method | TestWalkPythonDirs.test_skips_node_modules |
134 | |
| method | TestWalkPythonDirs.test_skips_daemon_dir |
142 | |
| method | TestWalkPythonDirs.test_empty_repo |
149 | |
| class | TestFileWatcherInit |
154 | |
| method | TestFileWatcherInit.test_initial_state |
155 | |
| method | TestFileWatcherInit.test_is_running_false_initially |
162 | |
| class | TestFileWatcherWatch |
166 | |
| method | TestFileWatcherWatch.test_watch_starts_thread |
167 | |
| method | TestFileWatcherWatch.test_watch_sets_callback |
173 | |
| method | TestFileWatcherWatch.test_watch_adds_watches |
180 | |
| class | TestFileWatcherStop |
186 | |
| method | TestFileWatcherStop.test_stop_after_watch |
187 | |
| method | TestFileWatcherStop.test_stop_without_watch |
193 | |
| method | TestFileWatcherStop.test_stop_idempotent |
197 | |
| method | TestFileWatcherStop.test_stop_is_prompt_when_idle |
203 | stop() must not block on the watch loop's sleep. |
| class | TestFileWatcherDetectsChanges |
218 | |
| method | TestFileWatcherDetectsChanges.test_detects_file_modification |
219 | |
| method | TestFileWatcherDetectsChanges.test_detects_file_creation |
241 | |
| method | TestFileWatcherDetectsChanges.test_ignores_non_python_files |
261 | |
| class | TestFileWatcherAddWatch |
283 | |
| method | TestFileWatcherAddWatch.test_add_watch_no_libc |
284 | |
| method | TestFileWatcherAddWatch.test_add_watch_negative_fd |
291 | |
| class | TestFileWatcherCallbackError |
298 | |
| method | TestFileWatcherCallbackError.test_callback_exception_does_not_crash |
299 |
tests/refactor/codemod/test_ipc_protocol.py
source · 86 tests · 1661 lines
BDD + pytest tests for JSON-RPC 2.0 IPC protocol.
Covers: refactor.codemod.client, refactor.codemod.report, refactor.codemod.server, refactor.codemod.workspace
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestJsonRpcHelpers |
53 | |
| method | TestJsonRpcHelpers.test_jsonrpc_error |
54 | |
| method | TestJsonRpcHelpers.test_jsonrpc_error_no_id |
61 | |
| method | TestJsonRpcHelpers.test_jsonrpc_result |
65 | |
| method | TestJsonRpcHelpers.test_jsonrpc_result_no_id |
71 | |
| class | TestResolvePass |
76 | |
| method | TestResolvePass.test_resolve_known_pass |
77 | |
| method | TestResolvePass.test_resolve_unknown_pass |
82 | |
| method | TestResolvePass.test_resolve_non_class_attribute |
85 | |
| class | TestServerInit |
89 | |
| method | TestServerInit.test_initial_state |
90 | |
| class | TestHandleRequest |
98 | |
| method | TestHandleRequest.test_no_workspace |
99 | |
| method | TestHandleRequest.test_invalid_version |
105 | |
| method | TestHandleRequest.test_invalid_method_type |
114 | |
| method | TestHandleRequest.test_method_not_found |
123 | |
| method | TestHandleRequest.test_read_method_dispatched_without_lock |
131 | |
| method | TestHandleRequest.test_write_method_set |
135 | |
| method | TestHandleRequest.test_read_method_set |
140 | |
| class | TestServerSocketLifecycle |
147 | |
| method | TestServerSocketLifecycle.test_serve_creates_socket |
148 | |
| method | TestServerSocketLifecycle.test_stop_cleans_socket |
174 | |
| method | TestServerSocketLifecycle.test_serve_removes_stale_socket |
197 | |
| class | TestClientServerIntegration |
224 | |
| method | TestClientServerIntegration.test_client_connect_and_query |
225 | |
| method | TestClientServerIntegration.test_client_context_manager |
260 | |
| method | TestClientServerIntegration.test_client_query_cycles |
290 | |
| method | TestClientServerIntegration.test_client_invalid_method |
326 | |
| method | TestClientServerIntegration.test_client_run_unknown_pass |
356 | |
| class | TestClientEdgeCases |
387 | |
| method | TestClientEdgeCases.test_call_without_connection |
388 | |
| method | TestClientEdgeCases.test_connect_to_nonexistent_socket |
395 | |
| method | TestClientEdgeCases.test_close_without_connection |
402 | |
| method | TestClientEdgeCases.test_close_idempotent |
408 | |
| class | TestServerCleanup |
416 | |
| method | TestServerCleanup.test_cleanup_socket_missing |
417 | |
| method | TestServerCleanup.test_cleanup_socket_exists |
421 | |
| method | TestServerCleanup.test_cleanup_socket_none |
428 | |
| class | TestServerHandleClient |
433 | Test _handle_client with raw socket connections. |
| method | TestServerHandleClient.test_malformed_json_returns_parse_error |
436 | |
| method | TestServerHandleClient.test_empty_lines_ignored |
471 | |
| method | TestServerHandleClient.test_client_disconnect_decrements_count |
505 | |
| method | TestServerHandleClient.test_commit_missing_changes_param |
537 | |
| method | TestServerHandleClient.test_query_breaking_changes |
571 | |
| class | TestClientHighLevelMethods |
616 | Test client convenience methods through real client-server connection. |
| method | TestClientHighLevelMethods.test_query_dependencies_rejects_an_unknown_node |
667 | |
| method | TestClientHighLevelMethods.test_query_dependents_rejects_an_unknown_node |
671 | |
| method | TestClientHighLevelMethods.test_query_blast_radius_rejects_an_unknown_node |
675 | |
| method | TestClientHighLevelMethods.test_query_blast_radius_returns_a_record_not_a_list |
679 | The SUCCESS path — the shape, not just the error path. |
| method | TestClientHighLevelMethods.test_query_dependencies_returns_node_ids_not_keys |
710 | list[str] was wrong here too — the daemon returns CIG ids. |
| method | TestClientHighLevelMethods.test_query_topological_order |
731 | |
| method | TestClientHighLevelMethods.test_query_affected_tests |
735 | |
| method | TestClientHighLevelMethods.test_query_coupling_score_rejects_an_unknown_node |
741 | |
| method | TestClientHighLevelMethods.test_query_abstraction_level_rejects_an_unknown_node |
745 | |
| method | TestClientHighLevelMethods.test_query_centrality |
751 | |
| method | TestClientHighLevelMethods.test_query_impact_score_rejects_an_unknown_node |
755 | |
| method | TestClientHighLevelMethods.test_run_pass |
759 | |
| method | TestClientHighLevelMethods.test_commit |
769 | |
| method | TestClientHighLevelMethods.test_reload |
781 | |
| class | TestClientErrorPaths |
787 | Test client error handling branches. |
| method | TestClientErrorPaths.test_recv_response_socket_closed |
790 | |
| method | TestClientErrorPaths.test_close_with_socket_error |
821 | |
| method | TestClientErrorPaths.test_recv_malformed_response_skipped |
853 | |
| class | TestServerErrorPaths |
885 | Test server error handling branches. |
| method | TestServerErrorPaths.test_stop_with_socket_error |
888 | |
| method | TestServerErrorPaths.test_handle_request_internal_error |
913 | |
| method | TestServerErrorPaths.test_cleanup_socket_oserror |
939 | |
| class | TestConstants |
947 | |
| method | TestConstants.test_jsonrpc_version |
948 | |
| method | TestConstants.test_max_message_size |
951 | |
| method | TestConstants.test_read_methods_frozen |
954 | |
| method | TestConstants.test_write_methods_frozen |
957 | |
| method | TestConstants.test_no_overlap_between_read_and_write |
960 | |
| method | TestConstants.test_resolve_nodes_is_a_read_method |
963 | |
| class | TestPendingRuns |
994 | run_pass keeps its run on the server; commit names it (D29, REQ-110-137/138). |
| method | TestPendingRuns.test_resolve_nodes_names_the_ids_and_omits_unknown_ones |
1017 | |
| method | TestPendingRuns.test_run_pass_then_commit_by_reference_writes_the_file |
1032 | |
| method | TestPendingRuns.test_stacked_passes_keep_the_first_original_for_the_restore |
1050 | |
| method | TestPendingRuns.test_commit_without_a_known_run_id_is_refused |
1068 | |
| method | TestPendingRuns.test_a_connection_holds_one_run_and_cannot_reload_under_it |
1077 | |
| method | TestPendingRuns.test_an_unknown_pass_leaves_the_write_lock_free |
1088 | |
| method | TestPendingRuns.test_a_failing_pass_constructor_is_an_internal_error_and_frees_the_lock |
1101 | |
| method | TestPendingRuns.test_a_refused_review_restores_the_forest_and_ends_the_run |
1111 | |
| method | TestPendingRuns.test_a_disk_edit_during_the_run_fails_the_commit_and_restores |
1129 | |
| method | TestPendingRuns.test_a_run_by_the_in_process_caller_ends_with_release_connection |
1150 | |
| method | TestPendingRuns.test_malformed_write_params_are_refused_before_any_lock_is_taken |
1171 | |
| method | TestPendingRuns.test_status_reports_the_roots_the_workspace_was_loaded_from |
1189 | |
| method | TestPendingRuns.test_reload_keeps_the_roots_the_daemon_was_loaded_with |
1193 | |
| method | TestPendingRuns.test_reload_of_a_whole_repo_daemon_stays_whole_repo |
1205 | |
| method | TestPendingRuns.test_reload_reuses_the_parse_cache_the_daemon_was_loaded_with |
1236 | |
| class | TestWriterSerialization |
1262 | Writers take turns; the reload swap, the lease and the lock wait (F2, F3, F6). |
| method | TestWriterSerialization.test_a_second_writer_blocks_until_the_first_commits |
1285 | |
| method | TestWriterSerialization.test_replace_workspace_waits_for_the_pending_run_and_then_swaps |
1315 | |
| method | TestWriterSerialization.test_a_swap_cannot_land_between_two_passes_of_one_run |
1338 | |
| method | TestWriterSerialization.test_a_reload_loaded_before_a_commit_is_dropped |
1373 | |
| method | TestWriterSerialization.test_an_idle_run_expires_when_another_writer_arrives |
1402 | |
| method | TestWriterSerialization.test_an_expiry_never_ends_a_run_whose_owner_went_busy_in_the_gap |
1451 | 20 pairs of the real race: A's commit against B's write, A idle past its lease. |
| method | TestWriterSerialization.test_an_expiry_rechecks_the_run_under_the_lock_before_it_pops |
1527 | The state the idle scan leaves behind: it listed the run as stale, and |
| method | TestWriterSerialization.test_a_request_inside_the_lease_keeps_the_run_alive |
1562 | |
| method | TestWriterSerialization.test_an_invalid_literal_replacement_is_no_change_not_an_internal_error |
1591 | |
| method | TestWriterSerialization.test_a_blocked_writer_gives_up_with_the_lock_timeout_message |
1618 |
tests/refactor/codemod/test_observability.py
source · 74 tests · 1043 lines
Tests for SPEC-110 observability — all 5 observers.
Covers: core.base.traces, core.protocols.base, refactor.codemod.observability.debug_panel, refactor.codemod.observability.error_detector, refactor.codemod.observability.events, refactor.codemod.observability.graph_writer, refactor.codemod.observability.metrics, refactor.codemod.observability.tracing, refactor.codemod.persistence.repository, refactor.codemod.report, refactor.codemod.workspace, refactor.codemod.observability/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestTracingObserver |
90 | |
| method | TestTracingObserver.test_on_event_pass_started |
91 | |
| method | TestTracingObserver.test_on_event_pass_completed_with_timing |
97 | |
| method | TestTracingObserver.test_on_event_workspace_loaded |
106 | |
| method | TestTracingObserver.test_on_event_error |
111 | |
| method | TestTracingObserver.test_on_event_review_started |
116 | |
| method | TestTracingObserver.test_on_event_review_completed |
122 | |
| method | TestTracingObserver.test_on_event_commit_started |
130 | |
| method | TestTracingObserver.test_on_event_commit_completed |
136 | |
| method | TestTracingObserver.test_completed_without_start_uses_data_duration |
144 | |
| method | TestTracingObserver.test_span_names_coverage |
152 | |
| method | TestTracingObserver.test_span_start_types |
158 | |
| method | TestTracingObserver.test_span_end_types |
163 | |
| method | TestTracingObserver.test_is_observer |
168 | |
| class | TestMetricsObserver |
178 | |
| method | TestMetricsObserver.test_pass_completed_event |
179 | |
| method | TestMetricsObserver.test_review_completed_with_errors |
192 | |
| method | TestMetricsObserver.test_review_completed_with_warnings_only |
200 | |
| method | TestMetricsObserver.test_review_completed_info_only |
208 | |
| method | TestMetricsObserver.test_commit_completed_event |
216 | |
| method | TestMetricsObserver.test_workspace_loaded_event |
224 | |
| method | TestMetricsObserver.test_error_event |
229 | |
| method | TestMetricsObserver.test_pass_completed_no_files |
234 | |
| method | TestMetricsObserver.test_is_observer |
247 | |
| method | TestMetricsObserver.test_noop_counter |
251 | |
| method | TestMetricsObserver.test_noop_histogram |
258 | |
| method | TestMetricsObserver.test_build_metrics_noop_fallback |
264 | |
| class | TestDebugPanelObserver |
285 | |
| method | TestDebugPanelObserver.test_writes_ndjson |
286 | |
| method | TestDebugPanelObserver.test_multiple_events |
300 | |
| method | TestDebugPanelObserver.test_multiple_correlations |
313 | |
| method | TestDebugPanelObserver.test_close_clears_handles |
331 | |
| method | TestDebugPanelObserver.test_default_output_dir |
338 | |
| method | TestDebugPanelObserver.test_is_observer |
342 | |
| class | TestErrorDetector |
352 | |
| method | TestErrorDetector.test_non_error_event_clears_window |
353 | |
| method | TestErrorDetector.test_three_consecutive_parse_failures |
361 | |
| method | TestErrorDetector.test_below_threshold_no_alert |
373 | |
| method | TestErrorDetector.test_non_parse_errors_no_alert |
383 | |
| method | TestErrorDetector.test_alert_only_once |
393 | |
| method | TestErrorDetector.test_drain_alerts |
403 | |
| method | TestErrorDetector.test_different_correlation_ids |
415 | |
| method | TestErrorDetector.test_custom_patterns |
427 | |
| method | TestErrorDetector.test_alert_payload_fields |
437 | |
| method | TestErrorDetector.test_is_observer |
451 | |
| method | TestErrorDetector.test_message_based_parse_detection |
455 | |
| class | TestEventBusAdapter |
471 | |
| method | TestEventBusAdapter.test_emit_without_bus |
472 | |
| method | TestEventBusAdapter.test_drain |
480 | |
| method | TestEventBusAdapter.test_pending_returns_copy |
490 | |
| class | TestGraphWriterObserver |
506 | |
| method | TestGraphWriterObserver.test_buffer_commit_completed |
507 | |
| method | TestGraphWriterObserver.test_buffer_pass_completed |
527 | |
| method | TestGraphWriterObserver.test_buffer_overflow_drops_events |
542 | |
| method | TestGraphWriterObserver.test_flush_without_repository |
554 | |
| method | TestGraphWriterObserver.test_flush_with_repository |
565 | |
| method | TestGraphWriterObserver.test_flush_handles_repository_error |
603 | |
| method | TestGraphWriterObserver.test_ignored_event_types |
624 | |
| method | TestGraphWriterObserver.test_dropped_count_property |
637 | |
| method | TestGraphWriterObserver.test_pass_buffer_overflow |
649 | |
| method | TestGraphWriterObserver.test_is_observer |
665 | |
| method | TestGraphWriterObserver.test_codemod_run_fields |
669 | |
| method | TestGraphWriterObserver.test_codemod_pass_fields |
688 | |
| class | TestCodemodEvent |
708 | |
| method | TestCodemodEvent.test_event_creation |
709 | |
| method | TestCodemodEvent.test_event_types |
721 | |
| class | TestObserverProtocol |
737 | |
| method | TestObserverProtocol.test_tracing_is_observer |
738 | |
| method | TestObserverProtocol.test_metrics_is_observer |
741 | |
| method | TestObserverProtocol.test_debug_panel_is_observer |
744 | |
| method | TestObserverProtocol.test_error_detector_is_observer |
747 | |
| method | TestObserverProtocol.test_graph_writer_is_observer |
750 | |
| class | TestObservabilityPackage |
759 | |
| method | TestObservabilityPackage.test_all_exports |
760 | |
| class | TestWorkspaceRunObserverComposition |
850 | REQ-110-025/REQ-110-027: workspace.run() composes the given (or |
| method | TestWorkspaceRunObserverComposition.test_run_emits_pass_completed_to_a_real_graph_writer_observer |
855 | A real GraphWriterObserver, passed via observers=, |
| method | TestWorkspaceRunObserverComposition.test_run_pass_event_payload_via_debug_panel_ndjson |
870 | DebugPanelObserver's real NDJSON output, driven only through |
| method | TestWorkspaceRunObserverComposition.test_run_falls_back_to_class_name_and_transform_type |
897 | A pass without .name/.pass_type still yields a usable |
| method | TestWorkspaceRunObserverComposition.test_run_observers_override_replaces_defaults |
914 | An explicit (even empty) observers list REPLACES the |
| method | TestWorkspaceRunObserverComposition.test_default_observer_set_is_empty |
924 | REQ-110-027: omitting observers composes NO observers (zero |
| class | TestWorkspaceCommitObserverComposition |
940 | REQ-110-025/REQ-110-027: workspace.commit() composes the given |
| method | TestWorkspaceCommitObserverComposition.test_commit_event_sequence_and_payload_via_debug_panel_ndjson |
945 | |
| method | TestWorkspaceCommitObserverComposition.test_commit_abort_emits_review_events_but_not_commit_events |
989 | An error-severity finding aborts the commit (REQ-110-013) |
| method | TestWorkspaceCommitObserverComposition.test_commit_emits_completed_to_a_real_graph_writer_observer |
1019 | A real GraphWriterObserver, passed via observers=, |
| method | TestWorkspaceCommitObserverComposition.test_commit_observers_override_replaces_defaults |
1035 | An explicit (even empty) observers list REPLACES the |
tests/refactor/codemod/test_observability_wiring.py
source · 20 tests · 476 lines
Tests for SPEC-110 observability wiring (REQ-110-025, REQ-110-027).
Covers: core.base.traces, core.patterns.observer, refactor.codemod.observability.events, refactor.codemod.passes, refactor.codemod.report, refactor.codemod.txn, refactor.codemod.workspace, refactor.ctok/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestEventVocabulary |
129 | |
| method | TestEventVocabulary.test_event_type_has_the_thirteen_named_kinds |
130 | |
| method | TestEventVocabulary.test_error_alias_is_the_error_detected_member |
148 | |
| method | TestEventVocabulary.test_observer_is_the_core_protocol |
152 | |
| class | TestLoadEvents |
157 | |
| method | TestLoadEvents.test_workspace_loaded_reports_truthful_module_count |
158 | |
| method | TestLoadEvents.test_unparsable_file_emits_error_detected_and_still_loads |
177 | |
| method | TestLoadEvents.test_load_without_observers_emits_to_nobody |
195 | |
| class | TestRunEvents |
210 | |
| method | TestRunEvents.test_pass_pair_with_file_mutations_share_one_correlation_id |
211 | |
| method | TestRunEvents.test_workspace_level_subscription_sees_every_operation |
229 | |
| method | TestRunEvents.test_default_observers_none_emits_to_nobody |
240 | |
| method | TestRunEvents.test_per_call_observers_are_unsubscribed_after_the_call |
248 | |
| method | TestRunEvents.test_concurrent_operations_have_distinct_correlation_ids |
257 | |
| method | TestRunEvents.test_raising_observer_does_not_fail_run_or_starve_recorder |
281 | |
| method | TestRunEvents.test_observer_on_both_buses_receives_each_event_once |
302 | |
| method | TestRunEvents.test_error_detected_accompanies_the_raised_pass_exception |
315 | |
| class | TestCommitEvents |
334 | |
| method | TestCommitEvents.test_two_passes_editing_one_file_commit_with_both_replacements |
335 | |
| method | TestCommitEvents.test_dry_run_commit_event_sequence_with_findings |
360 | |
| method | TestCommitEvents.test_review_gate_refusal_emits_commit_aborted_without_started |
383 | |
| method | TestCommitEvents.test_real_commit_writes_files_and_completes |
401 | |
| method | TestCommitEvents.test_review_exception_emits_error_and_aborted_then_raises |
419 | |
| method | TestCommitEvents.test_failed_write_emits_rollback_error_and_aborted |
434 |
tests/refactor/codemod/test_parse_cache.py
source · 17 tests · 226 lines
Tests for the content-addressed disk parse cache (_parse_cache.py).
Covers: refactor.codemod._parse_cache, refactor.codemod.workspace, refactor.ctok/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestCacheKey |
41 | cache_key is content-addressed and version-stamped. |
| method | TestCacheKey.test_same_bytes_same_key |
44 | |
| method | TestCacheKey.test_different_bytes_different_key |
47 | |
| method | TestCacheKey.test_key_contains_format_and_ctok_version |
50 | |
| class | TestParseCache |
55 | ParseCache get/put round-trips real LosslessModules. |
| method | TestParseCache.test_get_missing_returns_none |
58 | |
| method | TestParseCache.test_put_then_get_roundtrip |
62 | |
| method | TestParseCache.test_get_corrupt_entry_evicts_and_misses |
73 | |
| method | TestParseCache.test_get_non_module_entry_evicts_and_misses |
82 | |
| method | TestParseCache.test_directory_created_lazily_by_init |
93 | |
| method | TestParseCache.test_get_eviction_failure_still_misses |
99 | A corrupt entry in a read-only dir cannot be evicted; get() |
| method | TestParseCache.test_put_failure_does_not_raise |
115 | A cache directory that vanishes mid-flight must not break put(). |
| method | TestParseCache.test_put_cleans_up_temp_file_on_replace_failure |
123 | If os.replace fails, the temp file is removed and put() survives. |
| class | TestWorkspaceLoadCache |
137 | CodemodWorkspace.load(cache_dir=...) behavior. |
| method | TestWorkspaceLoadCache.test_cold_load_populates_cache |
140 | |
| method | TestWorkspaceLoadCache.test_warm_load_returns_identical_code |
151 | |
| method | TestWorkspaceLoadCache.test_warm_load_does_not_reparse |
165 | After a warm load, deleting the sources must not matter — but |
| method | TestWorkspaceLoadCache.test_cached_load_matches_uncached_load |
186 | |
| method | TestWorkspaceLoadCache.test_unparsable_file_not_cached |
201 | |
| method | TestWorkspaceLoadCache.test_parallel_cached_load |
213 |
tests/refactor/codemod/test_persistence_package.py
source · 2 tests · 65 lines
orchestrata_ultimate.refactor.codemod.persistenceis a regular package.
Covers: refactor.codemod.persistence/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_persistence_is_a_regular_package_with_its_repository |
30 | |
| function | test_the_import_closure_resolves_the_package_for_the_deployed_daemon |
41 |
tests/refactor/codemod/test_persistence_repository_coverage.py
source · 15 tests · 329 lines
Coverage tests for refactor.codemod.persistence.repository (SPEC-110).
Covers: core.graph.adapters.bolt_sync, knowledge_graph.canonical_schema, refactor.codemod._types, refactor.codemod.persistence.repository, refactor.codemod.report
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestProtocolConformance |
94 | |
| method | TestProtocolConformance.test_bolt_repo_satisfies_protocol |
95 | |
| method | TestProtocolConformance.test_inmemory_repo_satisfies_protocol |
98 | |
| class | TestBoltSaveAndQueryRuns |
102 | |
| method | TestBoltSaveAndQueryRuns.test_save_run_query_runs_round_trip |
103 | |
| method | TestBoltSaveAndQueryRuns.test_save_run_is_idempotent_merge |
131 | |
| method | TestBoltSaveAndQueryRuns.test_query_runs_orders_by_started_at_desc_and_limits |
141 | |
| method | TestBoltSaveAndQueryRuns.test_query_runs_unknown_project_returns_empty |
158 | |
| class | TestBoltSavePassAndChanges |
162 | |
| method | TestBoltSavePassAndChanges.test_save_pass_links_to_run |
163 | |
| method | TestBoltSavePassAndChanges.test_save_changes_empty_is_noop |
189 | |
| method | TestBoltSavePassAndChanges.test_save_changes_links_entity_and_query_affected_code |
199 | |
| method | TestBoltSavePassAndChanges.test_query_affected_code_unknown_run_returns_empty |
240 | |
| class | TestBoltSaveFindings |
244 | |
| method | TestBoltSaveFindings.test_save_findings_empty_is_noop |
245 | |
| method | TestBoltSaveFindings.test_save_findings_round_trip_and_about_edge |
255 | |
| method | TestBoltSaveFindings.test_query_findings_unknown_run_returns_empty |
290 | |
| class | TestInMemoryRepository |
294 | |
| method | TestInMemoryRepository.test_run_pass_findings_changes_round_trip |
295 | |
| method | TestInMemoryRepository.test_queries_default_to_empty_for_unknown_run |
326 |
tests/refactor/codemod/test_review_catalogue.py
source · 9 tests · 210 lines
Tests for the SPEC-110 FR-012 check catalogue — review_catalogue.py.
Covers: core.base.traces, refactor.codemod.review_catalogue, refactor.codemod.review_checks
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_tst_110_021_catalogue_has_forty_checks_in_seven_categories |
65 | TST-110-021: 40 unique ids; per-category 4/6/4/6/10/6/4; phases 30/10. |
| function | test_shared_groups_give_thirty_distinct_implementations |
94 | Eight alias groups cover 18 ids: 40 - 18 + 8 = 30 implementations. |
| function | test_checks_for_phase_returns_each_implementation_in_its_owners_phase |
115 | Phase 1 and 2 hold every implementation once; phase 3 holds none. |
| function | test_default_substrates_match_the_contract |
131 | Every row matches the contract's check_catalogue row for its id. |
| function | test_registry_rejects_a_duplicate_id |
151 | Two rows with one id are refused. |
| function | test_registry_rejects_a_row_without_an_implementation |
160 | A row whose impl_key has no implementation is refused. |
| function | test_registry_rejects_an_alias_of_an_unknown_owner |
169 | An alias must name a row of the same impl_key. |
| function | test_registry_rejects_an_impl_key_with_only_aliases |
183 | An impl_key needs one owner row; aliases of aliases do not count. |
| function | test_a_small_registry_runs_each_owner_once_in_its_phase |
196 | An owner plus its alias is one implementation, in the owner's phase. |
tests/refactor/codemod/test_review_checks.py
source · 39 tests · 1174 lines
Tests for the SPEC-110 FR-012 check implementations — review_checks.py.
Covers: core.base.traces, refactor.codemod._cig_builder_ast, refactor.codemod.report, refactor.codemod.review_catalogue, refactor.codemod.review_checks, refactor.codemod.review_engine, refactor.codemod.workspace, refactor.ctok/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_tst_110_022_every_check_has_a_violating_and_a_clean_fixture |
336 | TST-110-022: 40 violating + 40 clean real modules; aliases report as owner. |
| function | test_reused_findings_carry_the_line_of_the_issue |
360 | A reused check's finding names the 1-based line it fired on. |
| function | test_mutable_defaults_reports_literals_through_reuse_and_calls_through_extension |
370 | The literal form is the reused function's; set()/list()/dict() the extension's. |
| function | test_error_handling_reports_bare_except_and_swallowed_exceptions |
390 | Swallowed handlers (pass/continue/...) extend the reused bare-except check. |
| function | test_scope_splits_source_checks_from_test_checks |
412 | Source-only checks skip tests; the isolation check runs on tests only. |
| function | test_dependency_check_is_silent_without_declared_dependencies |
431 | No pyproject dependencies means nothing to compare against. |
| function | test_issue_adapter_reads_the_line_in_every_description_style |
441 | L<n>:, (line <n>) and line <n> all give a line; none gives None. |
| function | test_source_lines_follow_readlines_semantics |
461 | Lines keep their newline; an unterminated last line has none. |
| function | test_reused_check_exposes_its_descriptor |
470 | The implementation reports the owner descriptor's identity. |
| function | test_trailing_whitespace_ignores_blanks_inside_multiline_strings |
485 | Trailing blanks a string literal owns are not style findings. |
| function | test_tab_and_final_newline_checks_report_their_lines |
505 | Tab indentation names the indented line; a missing final newline the last. |
| function | test_cyclomatic_counts_each_function_on_its_own |
521 | Branches of a nested function do not inflate its parent's score. |
| function | test_naming_accepts_dunders_privates_and_async_functions |
556 | Conventional names pass; async functions are held to snake_case too. |
| function | test_banned_library_check_reads_the_context_registry |
571 | Only the libraries named on the context are banned. |
| function | test_broad_raise_flags_bare_names_and_calls |
583 | raise Exception and raise BaseException(...) both count. |
| function | test_print_check_exempts_only_the_main_guard_body |
596 | print() under the guard is allowed; its else branch and others are not. |
| function | test_module_scoped_fixture_check_reads_scope_from_the_decorator |
610 | module/session/package/class scope are flagged; function scope is not. |
| function | test_global_state_flags_mutation_and_global_statements_only |
629 | A constant read by tests is not state; mutation and global are. |
| function | test_tst_110_023_no_check_opens_a_file_or_spawns_a_process |
680 | TST-110-023: running all 40 checks makes no open/subprocess call. |
| function | test_tst_110_023_checks_run_with_no_file_on_disk |
703 | The context's root and the path name nothing on disk, yet checks fire. |
| function | test_tst_110_023_modules_and_reused_functions_hold_no_io_calls |
713 | Source scan: no open()/subprocess/linter in the checks or what they reuse. |
| function | test_tst_110_023_lexical_checks_read_the_stream_and_structural_ones_the_tree |
752 | A module whose stream and tree disagree shows which layer each check reads. |
| function | test_cyclomatic_limit_is_pinned_from_both_sides |
789 | Exactly complexity 10 is clean; 11 flags. |
| function | test_blank_view_hides_literals_and_comments_but_keeps_geometry |
801 | Blanked tokens become spaces; newlines, columns and code survive. |
| function | test_mock_check_ignores_pattern_tables_in_strings_and_flags_real_calls |
830 | A regex table of mock names is data; a Mock( call is code. |
| function | test_secret_check_skips_comments_but_reads_string_literals |
853 | A secret in a comment is prose; a literal assignment is what it hunts. |
| function | test_local_module_check_ignores_imports_outside_the_loaded_roots |
869 | A narrow load cannot claim a sibling package's module is missing. |
| function | test_local_module_check_flags_the_missing_import_beside_an_out_of_scope_one |
890 | An out-of-scope import must not excuse a missing in-scope one. |
| function | test_local_module_check_uses_every_stored_include_root |
907 | Two includes under one package do not make their parent the scope. |
| function | test_full_load_roots_drop_no_local_module_finding |
923 | No roots, or a root that covers src, drops nothing the check finds. |
| function | test_absolute_include_root_still_reports_a_missing_in_scope_module |
947 | An absolute include stores a repo-relative root, so a miss is still reported. |
| function | test_sibling_script_import_present_in_the_forest_is_not_a_missing_local_module |
1011 | import b beside scripts/b.py names a file that is in the set. |
| function | test_sibling_rule_is_the_only_thing_dropping_the_finding |
1026 | The reused check does report the sibling import; only the sibling rule drops it. |
| function | test_src_module_importing_a_scripts_sibling_is_still_an_undeclared_third_party |
1053 | scripts/ is not on sys.path for src/: the import is an error. |
| function | test_submodule_of_a_plain_sibling_module_is_still_reported |
1071 | b.nope beside the plain module scripts/b.py names a file that cannot exist. |
| function | test_sibling_package_import_present_in_the_forest_is_not_a_missing_local_module |
1087 | import pkg beside scripts/pkg/__init__.py names a file in the set. |
| function | test_import_with_no_sibling_file_is_untouched_by_the_sibling_rule |
1101 | No scripts/gone.py or package: gone is third-party and still flags. |
| function | test_nested_stem_under_a_sibling_root_is_not_treated_as_local |
1118 | A stem three levels down is not importable by bare name; the finding stays. |
| function | test_extension_checks_are_review_checks |
1165 | The extension classes satisfy the ReviewCheck protocol on their own. |
tests/refactor/codemod/test_review_coverage.py
source · 11 tests · 288 lines
Coverage for PrologSemanticReview's live-Prolog query path — review.py.
Covers: core.paths, core.prolog_adapter, refactor.codemod.report, refactor.codemod.review, refactor.ctok/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestPrologQueryLoop |
58 | |
| method | TestPrologQueryLoop.test_codemod_review_pl_exists_where_review_looks |
59 | review.py resolves the rules file at |
| method | TestPrologQueryLoop.test_safe_mutation_produces_no_findings |
65 | pass_safe/3 binds Safe=true for a mutated module with no |
| method | TestPrologQueryLoop.test_unsafe_mutation_produces_warning_with_proof_tree |
79 | A user:unsafe_mutation/2 fact defeats pass_safe/3's first |
| method | TestPrologQueryLoop.test_only_the_unsafe_module_is_flagged |
108 | Per-(pass, module) attribution: with one safe and one unsafe |
| method | TestPrologQueryLoop.test_duplicate_module_pass_bindings_deduplicated |
129 | Two entries with the same (path, pass_name) assert two |
| class | TestExplainFailureEdges |
150 | |
| method | TestExplainFailureEdges.test_returns_none_when_goal_actually_succeeds |
151 | For a safe (pass, module) the explained goal succeeds, so |
| method | TestExplainFailureEdges.test_degrades_on_malformed_goal |
168 | A pass name containing a single quote produces a syntactically |
| class | TestCodemodReviewPredicates |
192 | Direct queries against the rules file, asserting janus's actual |
| method | TestCodemodReviewPredicates.test_blast_radius_ok_within_and_over_limit |
197 | |
| method | TestCodemodReviewPredicates.test_import_cycle_free_direct_and_transitive |
217 | |
| method | TestCodemodReviewPredicates.test_rename_safe_same_and_different_package |
245 | |
| method | TestCodemodReviewPredicates.test_string_replace_safe_fstring_and_format_call |
265 |
tests/refactor/codemod/test_review_engine.py
source · 31 tests · 1009 lines
Tests for the SPEC-110 FR-012 review engine — review_engine.py.
Covers: core.base.traces, refactor.codemod.observability.events, refactor.codemod.passes, refactor.codemod.report, refactor.codemod.review_catalogue, refactor.codemod.review_engine, refactor.codemod.workspace, refactor.ctok/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_narrow_include_roots_are_stored_and_scope_the_local_module_check |
199 | Repeated includes: unloaded siblings are out of scope, gone modules flag. |
| function | test_tst_110_024_phase_one_runs_files_in_parallel |
233 | TST-110-024: two files are inside phase 1 at once (a barrier proves it). |
| function | test_tst_110_024_phase_two_runs_after_phase_one_with_the_cig |
251 | TST-110-024: every phase-1 call precedes every phase-2 call. |
| function | test_tst_110_024_findings_and_events_follow_the_phase_order |
282 | TST-110-024: FINDING_EMITTED order is phase 1, phase 2, then phase 3. |
| function | test_without_phase_three_skips_the_prolog_pass |
319 | without_phase3() is a copy that never calls the phase-3 pass. |
| function | test_default_phase_three_is_the_prolog_semantic_review |
334 | Without prolog= the engine runs a real PrologSemanticReview. |
| function | test_baseline_must_be_absolute_or_delta |
344 | Anything else is refused at construction. |
| function | test_delta_is_the_default_baseline_and_absolute_reports_legacy_findings_too |
351 | ADR-0073: delta (default) reports only introduced findings; absolute all. |
| function | test_delta_ignores_legacy_findings_a_prepended_line_shifts |
403 | Inserting a line above legacy code moves its L<n>: text, not its identity. |
| function | test_delta_catches_exactly_the_finding_introduced_below_shifted_lines |
419 | A pass that shifts legacy code AND adds an error reports only the new one. |
| function | test_delta_reports_an_in_place_edit_of_a_line_that_already_carries_a_finding |
481 | The secret message names no content; the line's own text tells the edit apart. |
| function | test_delta_line_shift_alone_does_not_change_the_line_text |
506 | A prepend above a legacy secret moves its line number, not its text. |
| function | test_delta_strips_the_line_text_so_whitespace_only_edits_stay_legacy |
520 | Trailing whitespace on a legacy secret line is not a new secret. |
| function | test_delta_blanking_a_legacy_secret_does_not_hide_a_new_one_elsewhere |
535 | The masking shape: remove the legacy finding, add another with the same message. |
| function | test_review_detailed_under_absolute_has_no_legacy_and_review_returns_introduced |
558 | absolute puts every finding in introduced; review is that list. |
| function | test_delta_line_text_is_empty_without_a_line_a_tree_or_a_valid_range |
578 | A finding with no line, an out-of-range line or an unknown path keys on "". |
| function | test_line_free_strips_the_line_numbers_the_reused_checks_embed |
623 | Every shape the 20 reused functions emit normalises to a line-free key. |
| function | test_delta_matches_findings_with_multiplicity_and_ignores_lines |
631 | Two identical legacy findings stay legacy; a third is introduced. |
| function | test_tst_110_025_findings_come_from_the_mutated_tree_not_the_disk |
649 | TST-110-025: an in-memory os.environ[...] read is found; disk is clean. |
| function | test_tst_110_025_error_finding_aborts_the_commit_with_the_disk_untouched |
675 | TST-110-025 / ERR-110-002: the error finding yields success=False, no writes. |
| function | test_context_carries_the_mutated_forest_and_workspace_facts |
710 | Contexts see the mutated overlay, forest-derived modules, deps and roles. |
| function | test_declared_dependencies_normalises_names_and_tolerates_no_pyproject |
774 | Dependency names are lower-cased with underscores; no file means none. |
| function | test_declared_dependencies_read_every_declaration_site_and_import_names |
806 | Optional groups, dependency groups and uv dev deps count; so do import names. |
| function | test_third_party_check_accepts_a_distribution_whose_import_name_differs |
819 | import google.protobuf is declared by protobuf; numpy is not. |
| function | test_narrow_include_does_not_report_imports_outside_the_loaded_roots |
841 | A sibling-package import is outside the workspace; a missing sibling file is not. |
| function | test_top_level_and_test_path_classification |
895 | A forest path maps to the importable top-level name and a test role. |
| function | test_sibling_name_of_a_script_directly_under_scripts_is_its_stem |
918 | A sibling-import root contributes the stem or package directly under it. |
| function | test_sibling_script_import_is_not_an_undeclared_third_party |
926 | import b beside scripts/b.py is local; an undeclared numpy flags. |
| function | test_phase_runner_is_empty_without_checks_or_modules |
953 | No checks in the phase, or no modules, is no work and no findings. |
| function | test_phase_two_and_single_worker_runs_stay_on_the_calling_thread |
965 | Phase 2, and phase 1 with one worker, do not fan out. |
| function | test_a_crashing_check_is_not_a_clean_review |
992 | The exception reaches the caller; commit turns it into COMMIT_ABORTED. |
tests/refactor/codemod/test_review_engine_commit_wiring.py
source · 12 tests · 349 lines
Tests for the SPEC-110 commit wiring of the review engine (plan D7, D23).
Covers: core.base.traces, refactor.codemod.observability.events, refactor.codemod.passes, refactor.codemod.report, refactor.codemod.review, refactor.codemod.review_engine, refactor.codemod.workspace, refactor.ctok/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_tst_110_026_default_commit_runs_the_engine_before_write_back |
102 | TST-110-026: no arguments but the changes; the engine reviews, then writes. |
| function | test_tst_110_026_dry_run_commit_reports_the_engine_findings |
127 | TST-110-026: a dry run carries the findings and writes nothing. |
| function | test_engine_runs_before_the_callers_reviews_and_counts_as_one_review |
151 | An explicit engine goes first; REVIEW_STARTED counts engine plus reviews. |
| function | test_an_explicit_reviews_list_runs_as_given_without_a_default_engine |
172 | Plan D7: the default engine is built only when reviews is None. |
| function | test_run_review_engine_false_skips_the_engine |
187 | run_review_engine=False restores a review-free commit. |
| function | test_a_caller_prolog_review_does_not_run_twice |
210 | With a PrologSemanticReview in reviews the engine skips its phase 3. |
| function | test_default_commit_writes_when_the_only_error_finding_is_legacy |
241 | ADR-0073: the default engine is delta; a legacy error does not veto the write. |
| function | test_legacy_event_order_follows_the_introduced_events_of_the_same_review |
275 | TST-110-026 order: introduced FINDING_EMITTED first, then the legacy ones. |
| function | test_absolute_engine_still_aborts_on_a_legacy_error_finding |
293 | baseline='absolute' restores the unconditional abort of ERR-110-002. |
| function | test_no_engine_means_no_legacy_findings |
313 | run_review_engine=False and a caller-only review list carry none. |
| function | test_default_commit_aborts_when_the_change_introduces_an_error |
327 | The delta default still aborts on an error the pass itself adds. |
| function | test_commit_signature_appends_the_engine_parameters |
342 | The new parameters follow the existing ones, defaulting to the engine on. |
tests/refactor/codemod/test_review_passes.py
source · 88 tests · 980 lines
Tests for SPEC-110 review passes — review.py.
Covers: core.prolog_adapter, refactor.codemod.report, refactor.codemod.review, refactor.ctok/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestParseIntegrity |
89 | |
| method | TestParseIntegrity.test_valid_tree_no_findings |
90 | |
| method | TestParseIntegrity.test_multiple_valid_entries |
98 | |
| method | TestParseIntegrity.test_name |
108 | |
| method | TestParseIntegrity.test_empty_changeset |
111 | |
| method | TestParseIntegrity.test_complex_valid_tree |
117 | |
| method | TestParseIntegrity.test_round_trip_preserves_code |
133 | |
| method | TestParseIntegrity.test_is_review_pass |
139 | |
| method | TestParseIntegrity.test_syntax_error_reported |
143 | A mutated module whose bytes no longer parse is a PARSE_INTEGRITY finding. |
| class | TestBannedConstructs |
164 | |
| method | TestBannedConstructs.test_clean_code_no_findings |
165 | |
| method | TestBannedConstructs.test_bare_os_environ_detected |
173 | |
| method | TestBannedConstructs.test_bare_os_environ_reports_real_line_number |
182 | Row 16 fix: ast.Subscript.lineno is always populated (no more |
| method | TestBannedConstructs.test_banned_imports_come_from_the_registry_not_a_hardcoded_tuple |
199 | This pass held ("pytest_xdist", "xdist") in code until |
| method | TestBannedConstructs.test_a_dotted_registry_entry_bans_only_that_submodule |
221 | unittest.mock is banned, unittest is not. The visitor folded |
| method | TestBannedConstructs.test_os_environ_get_not_flagged |
246 | |
| method | TestBannedConstructs.test_mock_import_detected |
255 | |
| method | TestBannedConstructs.test_magic_mock_detected |
264 | |
| method | TestBannedConstructs.test_async_mock_detected |
273 | |
| method | TestBannedConstructs.test_patch_decorator_detected |
282 | |
| method | TestBannedConstructs.test_monkeypatch_detected |
291 | |
| method | TestBannedConstructs.test_banned_library_xdist |
300 | |
| method | TestBannedConstructs.test_banned_library_from_import |
309 | |
| method | TestBannedConstructs.test_banned_library_reports_real_line_number |
318 | Row 17 fix: ast.Import.lineno is always populated. |
| method | TestBannedConstructs.test_multiple_violations |
333 | |
| method | TestBannedConstructs.test_name |
342 | |
| method | TestBannedConstructs.test_is_review_pass |
345 | |
| method | TestBannedConstructs.test_comment_lines_skipped_for_mocks |
349 | |
| method | TestBannedConstructs.test_create_autospec_detected |
359 | |
| method | TestBannedConstructs.test_patch_object_detected |
368 | |
| method | TestBannedConstructs.test_patch_dict_detected |
377 | |
| method | TestBannedConstructs.test_custom_mock_class_detected |
386 | |
| method | TestBannedConstructs.test_custom_stub_class_detected |
395 | |
| method | TestBannedConstructs.test_custom_fake_class_detected |
404 | |
| method | TestBannedConstructs.test_pytest_mock_usage_detected |
413 | |
| method | TestBannedConstructs.test_empty_changeset |
422 | |
| method | TestBannedConstructs.test_severity_is_error |
428 | |
| class | TestDiffBudget |
442 | |
| method | TestDiffBudget.test_within_budget |
443 | |
| method | TestDiffBudget.test_file_budget_exceeded |
449 | |
| method | TestDiffBudget.test_line_budget_exceeded |
460 | |
| method | TestDiffBudget.test_both_exceeded |
470 | |
| method | TestDiffBudget.test_name |
483 | |
| method | TestDiffBudget.test_is_review_pass |
486 | |
| method | TestDiffBudget.test_default_limits |
490 | |
| method | TestDiffBudget.test_custom_limits |
495 | |
| method | TestDiffBudget.test_empty_changeset |
500 | |
| method | TestDiffBudget.test_severity_is_error |
506 | |
| class | TestPrologSemanticReview |
522 | |
| method | TestPrologSemanticReview.test_graceful_degradation_no_prolog |
523 | |
| method | TestPrologSemanticReview.test_name |
531 | |
| method | TestPrologSemanticReview.test_is_review_pass |
534 | |
| method | TestPrologSemanticReview.test_empty_changeset |
538 | |
| method | TestPrologSemanticReview.test_init_state |
544 | |
| class | TestOsEnvironVisitor |
555 | |
| method | TestOsEnvironVisitor.test_finds_bare_subscript |
556 | |
| method | TestOsEnvironVisitor.test_no_violation_for_get |
563 | |
| method | TestOsEnvironVisitor.test_multiple_violations |
569 | |
| method | TestOsEnvironVisitor.test_no_violation_for_other_subscript |
576 | |
| method | TestOsEnvironVisitor.test_violation_line_numbers_are_real |
582 | |
| method | TestOsEnvironVisitor.test_subscript_with_non_string_key |
590 | A dynamic subscript key (not a string literal) still counts |
| method | TestOsEnvironVisitor.test_nested_in_function |
599 | The ast walk must descend into function bodies (generic_visit). |
| class | TestBannedImportVisitor |
609 | |
| method | TestBannedImportVisitor.test_finds_banned_import |
610 | |
| method | TestBannedImportVisitor.test_no_violation_for_allowed |
616 | |
| method | TestBannedImportVisitor.test_from_import_banned |
622 | |
| method | TestBannedImportVisitor.test_case_insensitive_matching |
628 | |
| method | TestBannedImportVisitor.test_multi_alias_import_only_flags_banned_alias |
634 | import os, pytest_xdist -- only the banned alias is reported, |
| method | TestBannedImportVisitor.test_relative_import_without_module_ignored |
643 | from . import x has module=None -- must not crash or flag. |
| method | TestBannedImportVisitor.test_import_star_from_banned_module |
650 | |
| method | TestBannedImportVisitor.test_nested_in_function |
656 | The ast walk must descend into function bodies (generic_visit). |
| class | TestDefaultReviews |
671 | |
| method | TestDefaultReviews.test_default_reviews_tuple |
672 | |
| method | TestDefaultReviews.test_all_are_review_passes |
682 | |
| class | TestParseIntegrityFailures |
694 | |
| method | TestParseIntegrityFailures.test_unrelated_original_tree_does_not_affect_result |
695 | ParseIntegrity only checks mutated_tree's parseability -- an |
| method | TestParseIntegrityFailures.test_multiple_entries_mixed |
706 | Test multiple entries where all pass. |
| class | TestBannedConstructsInternal |
723 | |
| method | TestBannedConstructsInternal.test_check_os_environ_directly |
724 | Test _check_os_environ method directly. |
| method | TestBannedConstructsInternal.test_check_mocks_directly |
733 | Test _check_mocks method directly. |
| method | TestBannedConstructsInternal.test_check_banned_imports_directly |
742 | Test _check_banned_imports method directly. |
| method | TestBannedConstructsInternal.test_check_os_environ_empty_key |
751 | Test os.environ with empty key. |
| class | TestDiffBudgetEdgeCases |
765 | |
| method | TestDiffBudgetEdgeCases.test_exactly_at_budget |
766 | Test when changeset is exactly at budget limit. |
| method | TestDiffBudgetEdgeCases.test_one_over_budget |
777 | Test when changeset is one over budget. |
| class | TestPrologSemanticReviewInternal |
795 | |
| method | TestPrologSemanticReviewInternal.test_assert_facts_with_no_engine |
796 | Test _assert_facts when engine is None. |
| method | TestPrologSemanticReviewInternal.test_query_safety_with_no_engine |
805 | Test _query_safety when engine is None. |
| method | TestPrologSemanticReviewInternal.test_explain_failure_with_no_engine |
811 | Test _explain_failure when engine is None. |
| method | TestPrologSemanticReviewInternal.test_cleanup_facts_with_no_engine |
817 | Test _cleanup_facts when engine is None. |
| method | TestPrologSemanticReviewInternal.test_cleanup_facts_not_asserted |
823 | Test _cleanup_facts when facts were not asserted. |
| method | TestPrologSemanticReviewInternal.test_review_with_prolog_available |
830 | Test review method when Prolog is available but codemod_review.pl doesn't exist. |
| class | TestPrologSemanticReviewWithProlog |
845 | |
| method | TestPrologSemanticReviewWithProlog.test_review_exercises_prolog_path |
846 | Test that review() exercises the Prolog path when Prolog is available. |
| method | TestPrologSemanticReviewWithProlog.test_assert_and_cleanup_facts_with_real_engine |
862 | Test _assert_facts and _cleanup_facts with a real Prolog engine. |
| method | TestPrologSemanticReviewWithProlog.test_query_safety_without_pl_file |
888 | Test _query_safety when codemod_review.pl doesn't exist. |
| method | TestPrologSemanticReviewWithProlog.test_explain_failure_with_real_engine |
905 | Test _explain_failure with a real Prolog engine. |
| method | TestPrologSemanticReviewWithProlog.test_assert_facts_with_special_characters |
922 | Test _assert_facts with paths containing special characters. |
| method | TestPrologSemanticReviewWithProlog.test_review_multiple_entries |
946 | Test review with multiple entries. |
| method | TestPrologSemanticReviewWithProlog.test_review_degrades_on_bad_entry_path |
962 | review()'s try/except around _assert_facts/_query_safety must |
tests/refactor/codemod/test_server_coverage.py
source · 14 tests · 357 lines
Coverage tests for CodemodServer error/defensive paths (SPEC-110).
Covers: refactor.codemod.server, refactor.codemod.workspace
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestServeAcceptLoop |
97 | |
| method | TestServeAcceptLoop.test_accept_timeout_keeps_serving |
98 | Idle accept() times out every 1s; the loop must keep serving. |
| method | TestServeAcceptLoop.test_accept_oserror_while_running_logs_and_breaks |
123 | accept() raising OSError while _running logs an error and exits. |
| class | TestRequestStop |
149 | |
| method | TestRequestStop.test_request_stop_flags_and_closes |
150 | |
| method | TestRequestStop.test_request_stop_suppresses_close_oserror |
161 | request_stop is signal-safe: a failing close() must not escape. |
| class | TestStop |
168 | |
| method | TestStop.test_stop_tolerates_socket_close_oserror |
169 | |
| class | TestHandleClient |
178 | |
| method | TestHandleClient.test_recv_timeout_then_orphaned_fd_breaks_cleanly |
179 | Covers recv TimeoutError->continue, recv OSError->break, and the |
| method | TestHandleClient.test_non_dict_request_gets_internal_error_response |
216 | Valid JSON that is not an object (a list) makes handle_request raise |
| class | TestSendResponse |
243 | |
| method | TestSendResponse.test_send_response_warns_on_broken_pipe |
244 | |
| class | TestDispatchSuccessPaths |
253 | |
| method | TestDispatchSuccessPaths.test_query_dependents_matches_cig |
254 | |
| method | TestDispatchSuccessPaths.test_query_coupling_score_matches_cig |
271 | |
| method | TestDispatchSuccessPaths.test_query_abstraction_level_matches_cig |
291 | |
| class | TestDispatchErrorPaths |
312 | |
| method | TestDispatchErrorPaths.test_dispatch_unknown_method_fallthrough |
313 | _dispatch's terminal method-not-found line (reachable only by |
| method | TestDispatchErrorPaths.test_dispatch_internal_error_on_bad_change_payload |
324 | A non-KeyError failure inside a dispatch branch becomes -32603. |
| class | TestCleanupSocket |
345 | |
| method | TestCleanupSocket.test_cleanup_socket_tolerates_unlink_failure |
346 | unlink() on a path that exists but is a directory raises OSError; |
tests/refactor/codemod/test_transactional_writeback.py
source · 21 tests · 980 lines
BDD tests for SPEC-110 FR-005: Transactional Write-Back.
Covers: core.base.traces, refactor.codemod.observability.events, refactor.codemod.passes, refactor.codemod.report, refactor.codemod.txn, refactor.codemod.workspace, refactor.ctok.node_index, refactor.ctok.tokenizer, refactor.ctok/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_rollback_on_parse_failure |
138 | REQ-110-014, TST-110-005: post-write parse failure restores all files. |
| function | test_atomic_write |
224 | REQ-110-014: atomic write via temp-file + fsync + rename. |
| function | test_concurrent_edit_guard |
272 | REQ-110-015, TST-110-006: commit refused when file changed after load. |
| function | test_symlink_attack_prevented |
323 | REQ-110-015: symlink attack prevented with O_NOFOLLOW. |
| function | test_advisory_lock |
361 | REQ-110-015: advisory lock prevents concurrent writes. |
| function | test_dry_run |
395 | REQ-110-016, TST-110-009: dry-run produces report without writing. |
| function | test_machine_readable_report |
478 | REQ-110-017: successful commit produces expected result. |
| function | test_commit_preserves_target_file_mode |
534 | A file committed through CodemodWorkspace.commit keeps its mode. |
| function | test_commit_preserves_setuid_and_setgid_bits |
557 | setuid/setgid survive the write: fchmod runs after os.write |
| function | test_rollback_restores_read_only_target_and_reraises_original |
576 | R3-B1: a 0444 first target is rolled back byte-exact with its mode |
| function | test_failed_replace_leaves_no_temp_file |
616 | N-e: a rename that fails after mkstemp unlinks the temp file. The |
| function | test_write_atomic_refuses_a_vanished_target |
630 | M-c: a target deleted after the concurrent-edit check is refused with |
| function | test_concurrent_edit_error_names_what_was_compared |
645 | The refusal message says disk bytes were compared with the tree the |
| function | test_rollback_restores_only_written_entries |
688 | R4-B1: the second entry's forward write fails (EFBIG). The ORIGINAL |
| function | test_rollback_failure_never_masks_the_original_error |
724 | R4-B1: a per-file restore that fails is collected, noted on the |
| function | test_commit_refuses_a_target_already_deleted_when_commit_starts |
763 | R4-B1: a target that is gone when commit_changes STARTS is refused |
| function | test_commit_refuses_a_target_deleted_during_the_first_write |
786 | R5 M-a/M-b: the second target is deleted by another thread once the |
| function | test_a_raising_event_sink_never_masks_the_commit_failure |
839 | R5 note: an on_event callable that raises is logged and swallowed; |
| function | test_commit_succeeds_when_the_group_is_unmapped_in_a_user_namespace |
901 | R5-B1: under unshare -r (rootless containers, bubblewrap) a host |
| function | test_commit_preserves_the_target_group |
948 | M1: the rename swaps in an inode owned by the writer; fchown of |
| function | test_replace_file_with_a_group_the_writer_is_not_in |
967 | M1: fchown to a group the writer is not a member of is refused |
tests/refactor/codemod/test_transform_passes.py
source · 89 tests · 975 lines
Tests for SPEC-110 transform passes — passes.py.
Covers: core.base.traces, refactor.codemod.passes, refactor.codemod.report, refactor.ctok/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestReplaceStringLiteralPass |
62 | |
| method | TestReplaceStringLiteralPass.test_no_match_returns_none |
63 | |
| method | TestReplaceStringLiteralPass.test_exact_replacement |
70 | |
| method | TestReplaceStringLiteralPass.test_regex_replacement |
79 | |
| method | TestReplaceStringLiteralPass.test_keep_patterns_skips_file |
90 | |
| method | TestReplaceStringLiteralPass.test_keep_patterns_allows_non_matching |
99 | |
| method | TestReplaceStringLiteralPass.test_apply_across_multiple_files |
108 | |
| method | TestReplaceStringLiteralPass.test_single_quote_preservation |
119 | |
| method | TestReplaceStringLiteralPass.test_name_and_parallelism |
127 | |
| method | TestReplaceStringLiteralPass.test_description_in_entry |
132 | |
| method | TestReplaceStringLiteralPass.test_regex_no_match |
141 | |
| method | TestReplaceStringLiteralPass.test_concatenated_string_left_untouched |
148 | Pre-port LibCST parity: implicitly-concatenated literals are a |
| method | TestReplaceStringLiteralPass.test_fstring_pieces_left_untouched |
160 | f-string literal text pieces are ast.Constant str nodes too, but |
| method | TestReplaceStringLiteralPass.test_replace_in_bytes_literal |
170 | |
| class | TestAddImportPass |
184 | |
| method | TestAddImportPass.test_add_from_import |
185 | |
| method | TestAddImportPass.test_add_plain_import |
193 | |
| method | TestAddImportPass.test_add_aliased_import |
201 | |
| method | TestAddImportPass.test_skip_when_import_exists |
210 | |
| method | TestAddImportPass.test_skip_plain_import_exists |
217 | |
| method | TestAddImportPass.test_dotted_module_import |
224 | |
| method | TestAddImportPass.test_apply_across_workspace |
232 | |
| method | TestAddImportPass.test_format_import_from |
241 | |
| method | TestAddImportPass.test_format_import_from_alias |
245 | |
| method | TestAddImportPass.test_format_import_plain |
249 | |
| method | TestAddImportPass.test_name_and_parallelism |
253 | |
| method | TestAddImportPass.test_stdlib_group_ordering |
258 | |
| method | TestAddImportPass.test_description |
267 | |
| method | TestAddImportPass.test_stdlib_group_ordering_with_existing_from_import |
275 | Exercises the ast.ImportFrom branch of _find_insert_position |
| method | TestAddImportPass.test_insert_after_last_import_when_no_group_match |
287 | When existing imports are all in a LATER group than the new |
| method | TestAddImportPass.test_skip_star_import_not_matched |
301 | from x import * must not crash _ImportExistsVisitor and |
| method | TestAddImportPass.test_existing_from_import_different_module_not_matched |
311 | |
| method | TestAddImportPass.test_existing_from_import_checking_plain_import_not_matched |
319 | When checking for a PLAIN import X (self._name is None) the |
| method | TestAddImportPass.test_add_import_no_existing_imports_inserts_first |
331 | |
| method | TestAddImportPass.test_add_import_at_end_of_file_no_trailing_newline |
340 | |
| class | TestRemoveUnusedImportPass |
356 | |
| method | TestRemoveUnusedImportPass.test_remove_unused_from_import |
357 | |
| method | TestRemoveUnusedImportPass.test_keep_used_import |
365 | |
| method | TestRemoveUnusedImportPass.test_remove_unused_plain_import |
372 | |
| method | TestRemoveUnusedImportPass.test_keep_used_from_import |
380 | |
| method | TestRemoveUnusedImportPass.test_multiple_unused |
387 | |
| method | TestRemoveUnusedImportPass.test_apply_across_workspace |
398 | |
| method | TestRemoveUnusedImportPass.test_name_and_parallelism |
407 | |
| method | TestRemoveUnusedImportPass.test_description_count |
412 | |
| method | TestRemoveUnusedImportPass.test_no_imports_returns_none |
420 | |
| method | TestRemoveUnusedImportPass.test_partial_unused_combined_import_statement |
435 | import os, sys with only os unused must keep sys. |
| method | TestRemoveUnusedImportPass.test_partial_unused_combined_from_import |
449 | from x import a, b with mixed usage keeps the used name. |
| method | TestRemoveUnusedImportPass.test_partial_unused_last_alias_of_three |
463 | When the LAST alias in a multi-name import is unused, removal |
| method | TestRemoveUnusedImportPass.test_star_from_import_not_tracked_as_unused |
476 | from x import * can't be attributed to a used/unused name -- |
| method | TestRemoveUnusedImportPass.test_all_aliases_unused_removes_whole_statement |
485 | When EVERY alias on a multi-name statement is unused, the whole |
| class | TestDocstringSweepPass |
505 | |
| method | TestDocstringSweepPass.test_replace_in_docstring |
506 | |
| method | TestDocstringSweepPass.test_replace_in_comment |
514 | |
| method | TestDocstringSweepPass.test_no_match_returns_none |
522 | |
| method | TestDocstringSweepPass.test_multiple_replacements |
529 | |
| method | TestDocstringSweepPass.test_apply_across_workspace |
539 | |
| method | TestDocstringSweepPass.test_name_and_parallelism |
548 | |
| method | TestDocstringSweepPass.test_description_count |
553 | |
| method | TestDocstringSweepPass.test_concatenated_string_left_untouched |
561 | |
| method | TestDocstringSweepPass.test_fstring_pieces_left_untouched |
568 | |
| class | TestRenameSymbolPass |
581 | |
| method | TestRenameSymbolPass.test_apply_with_lsp_edits |
582 | |
| method | TestRenameSymbolPass.test_file_not_in_forest_skipped |
595 | |
| method | TestRenameSymbolPass.test_no_edits_produces_empty |
604 | |
| method | TestRenameSymbolPass.test_apply_file_method |
613 | |
| method | TestRenameSymbolPass.test_apply_file_no_match |
625 | |
| method | TestRenameSymbolPass.test_name_and_parallelism |
634 | |
| method | TestRenameSymbolPass.test_multiple_edits_same_file |
640 | |
| method | TestRenameSymbolPass.test_edits_producing_no_byte_change_returns_none |
655 | An edit that replaces text with itself changes nothing -- must |
| method | TestRenameSymbolPass.test_rename_changing_more_than_identifier_raises |
668 | The REQ-110-127 edit-safety gate: an edit claiming to be a |
| class | TestTransformPassBase |
691 | |
| method | TestTransformPassBase.test_apply_raises |
692 | |
| method | TestTransformPassBase.test_apply_file_raises |
697 | |
| method | TestTransformPassBase.test_default_name |
702 | |
| method | TestTransformPassBase.test_default_parallelism |
705 | |
| class | TestHelpers |
714 | |
| method | TestHelpers.test_classify_import_stdlib |
715 | |
| method | TestHelpers.test_classify_import_local |
722 | |
| method | TestHelpers.test_classify_import_third_party |
726 | |
| method | TestHelpers.test_extract_dotted_name_simple |
731 | |
| method | TestHelpers.test_extract_dotted_name_attribute |
735 | |
| method | TestHelpers.test_extract_dotted_name_deep |
739 | |
| method | TestHelpers.test_extract_dotted_name_other_expr |
746 | |
| class | TestEdgeCases |
756 | |
| method | TestEdgeCases.test_empty_forest |
757 | |
| method | TestEdgeCases.test_compose_multiple_passes |
763 | |
| method | TestEdgeCases.test_changeset_merge |
780 | |
| class | TestReplacePassPrefixAndQuoteGuards |
805 | |
| method | TestReplacePassPrefixAndQuoteGuards.test_the_string_prefix_survives_the_replacement |
808 | |
| method | TestReplacePassPrefixAndQuoteGuards.test_a_prefixed_regex_replacement_keeps_the_prefix |
816 | |
| method | TestReplacePassPrefixAndQuoteGuards.test_a_bytes_literal_is_left_alone_for_a_non_ascii_replacement |
822 | |
| method | TestReplacePassPrefixAndQuoteGuards.test_only_a_bytes_literal_with_a_non_ascii_replacement_means_no_change |
830 | |
| method | TestReplacePassPrefixAndQuoteGuards.test_a_replacement_that_breaks_the_delimiters_leaves_the_literal |
870 | |
| method | TestReplacePassPrefixAndQuoteGuards.test_a_replacement_that_fits_the_delimiters_is_applied |
899 | |
| method | TestReplacePassPrefixAndQuoteGuards.test_a_replacement_with_a_malformed_escape_leaves_the_literal |
928 | |
| method | TestReplacePassPrefixAndQuoteGuards.test_a_regex_result_with_a_nul_leaves_the_literal |
934 | |
| method | TestReplacePassPrefixAndQuoteGuards.test_a_legitimate_escape_is_applied |
962 | |
| method | TestReplacePassPrefixAndQuoteGuards.test_a_regex_result_that_breaks_the_delimiters_leaves_the_literal |
970 |
tests/refactor/codemod/test_watcher_coverage.py
source · 9 tests · 330 lines
Coverage tests for the inotify FileWatcher error/edge branches.
Covers: refactor.codemod.watcher
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestWatchWithoutLibc |
68 | |
| method | TestWatchWithoutLibc.test_devnull_fallback_eof_breaks_loop |
69 | With no libc, watch() falls back to /dev/null; its immediate EOF |
| class | TestWatchInitFailure |
89 | |
| method | TestWatchInitFailure.test_fd_exhaustion_raises_oserror |
90 | With RLIMIT_NOFILE at the current fd count, inotify_init1 and the |
| class | TestWatchLoopSelectError |
120 | |
| method | TestWatchLoopSelectError.test_invalid_fd_select_error_breaks_loop |
121 | An invalidated fd makes select() raise ValueError; with the stop |
| class | TestWatchLoopReadError |
139 | |
| method | TestWatchLoopReadError.test_pty_hangup_read_oserror_breaks_loop |
140 | A pty master whose slave is closed reports readable in select() |
| class | TestWatchLoopBlockingIO |
161 | |
| method | TestWatchLoopBlockingIO.test_blockingioerror_under_concurrent_drain_is_tolerated |
162 | When select() reports readable but another reader drains the fd |
| class | TestWatchLoopEventParsing |
222 | |
| method | TestWatchLoopEventParsing.test_truncated_event_breaks_parse_loop |
233 | Fewer bytes than EVENT_SIZE -> the parse loop breaks without |
| method | TestWatchLoopEventParsing.test_zero_length_name_event_is_ignored |
258 | An event with name_len == 0 yields an empty name, which is not a |
| class | TestNonPythonFileInWatchedDir |
278 | |
| method | TestNonPythonFileInWatchedDir.test_non_python_change_in_watched_dir_produces_no_callback |
279 | Real inotify events for non-.py files inside a watched directory |
| class | TestStopWithClosedFd |
311 | |
| method | TestStopWithClosedFd.test_stop_tolerates_already_closed_fd |
312 | If the fd was closed externally after the loop exited, stop()'s |
tests/refactor/codemod/test_workspace_index.py
source · 15 tests · 322 lines
BDD tests for CodemodWorkspace module and dependency index.
Covers: core.base.traces, refactor.codemod.workspace
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_modules_bidirectional |
18 | REQ-110-005: modules() returns bidirectional mapping. |
| function | test_dependencies_direct |
24 | REQ-110-005: dependencies() returns direct imports. |
| function | test_dependents_reverse |
30 | REQ-110-005: dependents() returns direct reverse imports. |
| function | test_symbol_table |
36 | REQ-110-007: symbol_table() returns top-level defined names. |
| class | TestWorkspaceDependencies |
166 | Test workspace.dependencies() method. |
| method | TestWorkspaceDependencies.test_dependencies_empty |
169 | dependencies() returns empty set for module with no imports. |
| method | TestWorkspaceDependencies.test_dependencies_unknown_module |
181 | dependencies() returns empty set for unknown module. |
| class | TestWorkspaceDependents |
194 | Test workspace.dependents() method. |
| method | TestWorkspaceDependents.test_dependents_empty |
197 | dependents() returns empty set for module with no importers. |
| method | TestWorkspaceDependents.test_dependents_unknown_module |
209 | dependents() returns empty set for unknown module. |
| class | TestWorkspaceSymbolTable |
222 | Test workspace.symbol_table() method. |
| method | TestWorkspaceSymbolTable.test_symbol_table_classes_and_functions |
225 | symbol_table() returns classes and functions. |
| method | TestWorkspaceSymbolTable.test_symbol_table_variables |
240 | symbol_table() returns module-level variables. |
| class | TestWorkspaceModules |
255 | Test workspace.modules() method. |
| method | TestWorkspaceModules.test_modules_contains_paths |
258 | modules() contains all loaded paths. |
| class | TestWorkspaceProperties |
272 | Test workspace properties. |
| method | TestWorkspaceProperties.test_forest_is_mapping |
275 | forest property returns a Mapping. |
| method | TestWorkspaceProperties.test_unparsable_is_tuple |
287 | unparsable property returns a tuple. |
| method | TestWorkspaceProperties.test_root_property |
298 | root property returns the repo root. |
| method | TestWorkspaceProperties.test_stats_property |
309 | stats() returns WorkspaceStats. |
tests/refactor/codemod/test_workspace_load.py
source · 38 tests · 740 lines
BDD tests for CodemodWorkspace.load() — lossless CST forest loading.
Covers: core.base.traces, refactor.codemod._cig_builder_ast, refactor.codemod._types, refactor.codemod.report, refactor.codemod.workspace, refactor.ctok/ (package)
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_load_parses_every_file |
29 | REQ-110-001, TST-110-001: Load parses every .py file under included roots. |
| function | test_round_trip_fidelity |
37 | REQ-110-002, TST-110-001: Round-trip fidelity. |
| function | test_comment_preservation |
45 | REQ-110-002, TST-110-002: Comment preservation. |
| function | test_unparseable_files |
53 | REQ-110-002: Unparseable files recorded. |
| function | test_memory_guard |
62 | REQ-110-004, TST-110-008: Memory guard. |
| function | test_include_root_is_stored_repo_relative_for_an_absolute_include |
650 | An absolute include folds onto the root; the same files load either way. |
| function | test_include_root_dot_stores_no_restriction |
663 | . is the whole repo: no roots stored, alone or beside another entry. |
| function | test_include_root_parent_traversal_inside_root_is_normalised |
675 | ../<repo>/src resolves inside the root: stored src, keyed repo-relative. |
| function | test_include_outside_the_repo_root_is_refused |
687 | An include that resolves outside the root raises, naming include and root. |
| function | test_include_through_a_symlink_to_outside_the_repo_is_refused |
697 | A symlink inside the repo that reaches outside is refused, not loaded. |
| function | test_include_through_a_symlink_inside_the_repo_is_accepted |
712 | A symlink that stays inside the repo is accepted; the lexical form is stored. |
| function | test_include_root_forms_src_slash_dot_slash_and_double_slash_still_normalise |
733 | Trailing, leading-dot and doubled slashes fold to one POSIX root. |
| class | TestWorkspaceCommit |
263 | Test workspace.commit() method. |
| method | TestWorkspaceCommit.test_commit_dry_run |
266 | commit(dry_run=True) produces report without writing. |
| method | TestWorkspaceCommit.test_commit_empty_changes |
281 | commit() with empty ChangeSet succeeds. |
| method | TestWorkspaceCommit.test_commit_report_to_json |
294 | CommitReport.to_json() produces valid JSON. |
| method | TestWorkspaceCommit.test_commit_writes_mutated_bytes_when_not_dry_run |
309 | commit(dry_run=False) with real entries writes module.code bytes. |
| method | TestWorkspaceCommit.test_commit_reports_failure_on_error_finding |
337 | An error-severity Finding from a review blocks the write. |
| method | TestWorkspaceCommit.test_commit_runs_passing_reviews |
368 | A review with no error findings lets commit succeed and is named. |
| class | TestChangeSet |
390 | Test ChangeSet data structure. |
| method | TestChangeSet.test_changeset_empty |
393 | Empty ChangeSet has zero entries. |
| method | TestChangeSet.test_changeset_merge |
400 | ChangeSet.merge() combines two changesets. |
| method | TestChangeSet.test_changeset_iter |
414 | ChangeSet is iterable. |
| class | TestWorkspaceRun |
443 | Test workspace.run() method. |
| method | TestWorkspaceRun.test_run_empty_passes |
446 | run() with empty passes list returns empty ChangeSet. |
| method | TestWorkspaceRun.test_run_applies_pass_and_updates_forest |
459 | run() merges the pass's ChangeSet and replaces the forest entry. |
| class | TestWorkspaceProperties |
474 | Test simple CodemodWorkspace properties. |
| method | TestWorkspaceProperties.test_root_property |
477 | .root returns the repository root passed to load(). |
| method | TestWorkspaceProperties.test_modules_bidirectional_mapping |
483 | .modules() maps both path->dotted and dotted->path. |
| class | TestWorkspaceSymbolTable |
494 | Test workspace.symbol_table() method. |
| method | TestWorkspaceSymbolTable.test_symbol_table_top_level_names |
497 | symbol_table() collects class/function/assign names per module. |
| class | TestWorkspaceDependencies |
515 | Test workspace.dependencies()/dependents() — direct CIG queries. |
| method | TestWorkspaceDependencies.test_dependencies_resolves_module_target |
547 | |
| method | TestWorkspaceDependencies.test_dependents_resolves_module_source |
551 | |
| method | TestWorkspaceDependencies.test_dependencies_unknown_module_returns_empty |
555 | |
| method | TestWorkspaceDependencies.test_dependents_unknown_module_returns_empty |
559 | |
| class | TestWorkspaceResolveModule |
564 | Test workspace._resolve_module() method. |
| method | TestWorkspaceResolveModule.test_resolve_by_path |
567 | _resolve_module() resolves by file path. |
| method | TestWorkspaceResolveModule.test_resolve_unknown |
579 | _resolve_module() returns None for unknown module. |
| method | TestWorkspaceResolveModule.test_resolve_by_dotted_name_direct_hit |
591 | _resolve_module() resolves a dotted name already in the module map. |
| method | TestWorkspaceResolveModule.test_resolve_by_unprefixed_path_falls_back_to_dotted |
600 | A path missing the storage prefix resolves via _path_to_dotted(). |
| class | TestPathToDotted |
612 | Test _path_to_dotted() helper. |
| method | TestPathToDotted.test_src_path |
615 | Convert src/ path to dotted name. |
| method | TestPathToDotted.test_tests_path |
621 | Convert tests/ path to dotted name. |
| method | TestPathToDotted.test_init_path |
627 | Convert init.py path to package name. |
| method | TestPathToDotted.test_no_prefix |
633 | Convert path without prefix to dotted name. |
tests/refactor/codemod/test_workspace_perf.py
source · 3 tests · 188 lines
Performance-band tests for CodemodWorkspace.load() — REQ-110-003 guards.
Covers: core.base.traces
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_serial_parse |
44 | REQ-110-003: per-file algorithm-regression guard over the frozen corpus. |
| function | test_parallel_parse |
101 | REQ-110-003, TST-110-008: throughput guard on a saturating synthetic corpus. |
| function | test_median_parse_seconds_rejects_runs_below_one |
185 | median_parse_seconds() raises on a nonsensical runs=0 request. |
Support files
Fixtures, package markers and helpers without test functions.