Orchestrata Ultimate › Tests › Reference › scripts › test_audit_test_purity

Tests reference — tests/scripts/test_audit_test_purity.py

Module of tests/scripts, split out because the directory page would be too large.

Prose pending.

tests/scripts/test_audit_test_purity.py

source · 66 tests · 852 lines

Tests for scripts/audit_test_purity.py — the test-purity forbidden-pattern

Kind Name Line Description
function test_normalize_pattern_strips_trailing_call_paren 71
function test_normalize_pattern_strips_leading_space 75
function test_normalize_pattern_strips_leading_equals 79
function test_normalize_pattern_is_a_noop_for_prefix_patterns 83
function test_normalize_pattern_is_a_noop_for_dotted_patterns 88
function test_name_matches_exact_bare_pattern 97
function test_name_matches_suffixed_bare_pattern 101
function test_name_matches_rejects_unrelated_prefix_collision 105
function test_name_matches_prefix_pattern_catches_the_intended_name 111
function test_name_matches_prefix_pattern_requires_the_underscore 120
function test_name_matches_infix_underscore_pattern 125
function test_name_matches_normalizes_paren_and_space_decorated_patterns 130
function test_name_matches_rejects_dispatch_against_patch_pattern 143
function test_attr_chain_matches_dotted_pattern_as_chain_substring 155
function test_attr_chain_matches_bare_pattern_against_attr_name 161
function test_attr_chain_matches_call_marked_pattern_requires_a_real_call 167
function test_attr_chain_matches_rejects_dispatch_false_positive 173
function test_attr_chain_matches_bare_pattern_from_space_decorated_form 181
function test_get_attr_chain_builds_dotted_string_for_multi_level_attribute 190
function test_get_attr_chain_builds_dotted_string_for_two_level_attribute 199
function test_get_attr_chain_falls_back_when_base_is_not_a_name 208
function test_scan_file_detects_magicmock_name 225
function test_scan_file_detects_asyncmock_and_mock_names 236
function test_scan_file_detects_mock_dot_patch_attribute 246
function test_scan_file_detects_unittest_mock_attribute 257
function test_scan_file_detects_pytest_mock_name 266
function test_scan_file_detects_mocker_fixture_usage 275
function test_scan_file_detects_bare_patch_call_attribute 284
function test_scan_file_does_not_flag_dispatch_attribute 295
function test_scan_file_detects_fake_prefix_variable 312
function test_scan_file_detects_underscore_fake_infix_variable 324
function test_scan_file_detects_stub_prefix_variable 333
function test_scan_file_detects_bare_fake_class_name 342
function test_scan_file_no_longer_excludes_fakeredis_stub_usage 363
function test_scan_file_no_longer_excludes_fakeredis_attribute_match 376
function test_scan_file_flags_fake_conn_unrelated_to_the_carve_out 388
function test_scan_file_flags_fakeredis_submodule_import_as_banned 406 RED->GREEN regression for the live defect: ``import fakeredis.aioredis
function test_scan_file_flags_bare_fakeredis_import_as_banned 421
function test_scan_file_flags_from_import_of_a_banned_submodule 430
function test_scan_file_does_not_flag_an_unbanned_import 440
function test_scan_file_banned_import_honours_injected_registry 450 The banned parameter lets a test exercise the import-level check
function test_scan_file_banned_import_reads_the_real_registry_by_default 468 No banned argument -> the real .claude/banned-libraries.txt,
function test_scan_file_detects_monkeypatch_positional_param 487
function test_scan_file_detects_monkeypatch_kwonly_param 497
function test_scan_file_detects_monkeypatch_on_async_def 507
function test_scan_file_detects_pytest_skip_call_attribute 522
function test_scan_file_detects_pytest_mark_skipif_attribute 531
function test_scan_file_detects_pytest_importorskip 540 Module-level importorskip silently greens the whole module when the
function test_scan_file_returns_empty_for_clean_file 556
function test_scan_file_returns_empty_dict_for_syntax_error_file 565
function test_scan_file_deduplicates_multiple_matches_on_the_same_line 571
function test_main_returns_error_when_tests_dir_missing 597
function test_main_accepts_individual_files 607 A file path is a valid target, not only a directory.
function test_main_accepts_several_paths_including_a_mix 636 Multiple targets, and a directory and a file together, both work.
function test_main_returns_zero_for_clean_tree 654
function test_main_detects_violations_and_returns_nonzero 667
function test_main_skips_pycache_directory 685
function test_main_skips_generated_recovery_directory 699
function test_main_truncates_output_after_ten_items_per_category 717
function test_main_parses_fix_flag_without_error 735
function test_main_reports_relative_path_under_tests_dir 746
function test_main_banned_import_only_narrows_a_stub_pattern_to_a_pass 765 A tree passed via --banned-import-only is narrowed to the
function test_main_banned_import_only_still_catches_banned_import_but_not_stub 787 The one category --banned-import-only DOES check still fires, and the
function test_main_banned_import_only_does_not_narrow_the_default_full_scope 807 --banned-import-only adds a SECOND, narrower scan group; it must not
function test_main_banned_import_only_missing_path_returns_error 826
function test_main_full_scope_wins_when_a_path_is_passed_both_ways 837 A path reachable through BOTH the full-scope positional args and