test_build_index_against_a_rust_repo_is_queryable

Tests › tests/test_cli_rustdoc.py

passed Passed in the packaged run.

What this test is for

Why it exists

The test says nothing about why.

Given

  1. db_path = tmp_path / "clew.db"
  2. build_index(output=db_path, repo_root=RUSTSAMPLE)
3 more
  1. conn = sqlite3.connect(str(db_path))
  2. try: names = {row[0] for row in conn.execute("SELECT name FROM memberdef")} assert {"add", "helper", "MAX_RETRIES"} <= names finally: conn.close()
  3. hits = search(db_path, "add")
→

When

  1. dossier = function_dossier(db_path, "add", repo_root=RUSTSAMPLE)
→

Then

  1. ✓ db_path.exists() holds
  2. ✓ any(hit.name == "add" for hit in hits) holds
  3. ✓ dossier is not None
  4. ✓ dossier.file equals "src/main.rs"
  5. ✓ dossier.brief equals "Adds two numbers together."
  6. ✓ " ".join(dossier.body.lines) contains "left + right"

What it exercises

The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.

clew — `main` (clew/cli.py) · 71 of 400 steps

… 10 earlier steps

command-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filesalt (line 1171)altopt (line 485)optmain11. propose → build_context11build_context12. build_context → derive_scope12derive_scope13. derive_scope → _declared_index_scope13_declared_index_scope▶ test enters14. _declared_index_scope → load_declaration_located14load_declaration_located15. load_declaration_located → _read_mapping15_read_mapping16. _read_mapping → _parsed_declaration16_parsed_declaration17. load_declaration_located → _checked_sections17_checked_sections

… 26 steps between

command-line usercommand-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filesother filesopt (line 696)opttry (line 1003)tryopt (line 845)optloop (line 1239)loopopt (line 847)optloop (line 746)looploop (line 1055)loopopt (line 1075)optopt (line 385)optmain44. _declared_index_scope → _existing_paths44_existing_paths45. derive_scope → whole_repo_scope45whole_repo_scope46. whole_repo_scope → _gitignored_paths46_gitignored_paths47. _gitignored_paths → git_argv47git_argv48–49. git_argv → _no_ext_diff48_no_ext_diff +1 more50. _gitignored_paths → git_env50git_env51. whole_repo_scope → list51list52. whole_repo_scope → nested_repo_roots52nested_repo_roots53. nested_repo_roots → _nested_repos_under53_nested_repos_under54–56. _nested_repos_under → _warn_unwalkable54_warn_unwalkable +2 more57. nested_repo_roots → _nested_repos_under57_nested_repos_under58. whole_repo_scope → _gitignored_paths58_gitignored_paths59–60. whole_repo_scope → _pruned_dirs59_pruned_dirs +1 more61. _pruned_dirs → _skip_dir61_skip_dir62–64. _pruned_dirs → _descendable62_descendable +2 more65–68. whole_repo_scope → _declaration_note65_declaration_note +3 more69. derive_scope → whole_repo_scope69whole_repo_scope▶ test enters70–72. build_context → repo_source_files70repo_source_files +2 more73. _ts_language_for → _grammar_available73_grammar_available74–75. _grammar_available → has_language74has_language +1 more76. _ts_language_for → _try_import_ts_module76_try_import_ts_module77–80. build_context → scope_membership77scope_membership +3 more81. _ast_parse_one_file → _ts_language_for81_ts_language_for▶ test enters82–85. _ast_parse_one_file → _cached_parser82_cached_parser +3 more86–87. _ast_parse_one_file → _disambiguate_header86_disambiguate_header +1 more

… 23 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/propose/astdefs.pyclew/propose/astdefs.pyclew/propose/astdefs.pyclew/propose/astdefs.pyother filesother filesother filesother filesmain111. _accessor_site → callee_name111callee_name112. build_context → load_declaration112load_declaration113. load_declaration → load_declaration_located113load_declaration_located▶ test enters114–115. propose → _sections114_sections +1 more

… 57 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/init_command.pyclew/init_command.pyclew/init_command.pyclew/init_command.pyother filesother filesother filesother filesloop (line 312)looploop (line 314)loopmain173. diagnose → _check_doxygen173_check_doxygen174. _check_doxygen → uses_rustdoc174uses_rustdoc175. uses_rustdoc → discover_doxyfile175discover_doxyfile▶ test enters176. uses_rustdoc → has_cargo_manifest176has_cargo_manifest177. _check_doxygen → _needs_doxygen177_needs_doxygen178. _needs_doxygen → claims178claims

… 27 steps between

command-line usercommand-line usercommand-line usercommand-line userother filesother filesother filesother filestry (line 155)trymain206–207. _locate → target_for206target_for +1 more208. target_for → state_home208state_home▶ test enters209–210. query_main → _payload209_payload +1 more

… 1 step between

command-line usercommand-line usercommand-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyother filesother filesother filesother filesother filesother filesloop (line 1576)looploop (line 1494)loopopt (line 1497)optloop (line 1507)loopmain212. corpus_payload → _symbol_corpus212_symbol_corpus213. _symbol_corpus → search_counted213search_counted214. search_counted → connect214connect▶ test enters215–216. search_counted → _memberdef_corpora215_memberdef_corpora +1 more217. _expansion_sql → has_columns217has_columns218. has_columns → table_exists218table_exists219. _memberdef_corpora → _memberdef_candidates219_memberdef_candidates220. _memberdef_candidates → table_exists220table_exists221. _memberdef_candidates → documented_first221documented_first222–223. documented_first → records_provenance222records_provenance +1 more224. _memberdef_candidates → symbol_provenance224symbol_provenance225. symbol_provenance → records_provenance225records_provenance226. _memberdef_candidates → self_declared_paths226self_declared_paths227. _memberdef_candidates → _one_line227_one_line228. _one_line → _doc_brief228_doc_brief229. _memberdef_candidates → strip_xml229strip_xml230. _memberdef_candidates → _search_rank230_search_rank231. _memberdef_candidates → symbol_provenance231symbol_provenance232. search_counted → _class_candidates232_class_candidates233. _class_candidates → _search_rank233_search_rank234. _class_candidates → class_rows234class_rows235. class_rows → table_exists235table_exists236. class_rows → strip_xml236strip_xml237. search_counted → _config_candidates237_config_candidates238. _config_candidates → _search_rank238_search_rank239. _config_candidates → gate_symbol_rows239gate_symbol_rows240. gate_symbol_rows → table_exists240table_exists241. gate_symbol_rows → has_columns241has_columns242. search_counted → _file_candidates242_file_candidates243. _file_candidates → self_declared_paths243self_declared_paths244–245. _file_candidates → _search_rank244_search_rank +1 more246. _file_candidates → file_doc_rows246file_doc_rows247. file_doc_rows → table_exists247table_exists248. _file_candidates → undocumented_path_rows248undocumented_path_rows249. undocumented_path_rows → table_exists249table_exists250. undocumented_path_rows → has_columns250has_columns251. undocumented_path_rows → table_exists251table_exists252. _symbol_corpus → search_emptiness252search_emptiness253. search_emptiness → index_scope253index_scope

… 99 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesmain353–354. lock_roster → nestings_on353nestings_on +1 more355. _layer_present → table_exists355table_exists▶ test enters356. nestings_on → table_exists356table_exists357. lock_roster → _nesting_pairs357_nesting_pairs

… 8 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyloop ×2 (line 944)loop ×2main366. thread_roster → has_columns366has_columns367. thread_roster → _thread_columns367_thread_columns368. _thread_columns → has_columns368has_columns▶ test enters369–370. _thread_columns → has_columns369has_columns ×2

… 21 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesloop (line 660)loopmain392. _gates → table_exists392table_exists393. _gates → _gate_columns393_gate_columns394. _gate_columns → has_columns394has_columns▶ test enters395. _gate_columns → has_columns395has_columns396. _gates → _with_defaults396_with_defaults397. _with_defaults → table_exists397table_exists▶ test enters398. _with_defaults → _defaults_for_macros398_defaults_for_macros399. _with_defaults → decided_default399decided_default

… 1 later step

8 more

tests/test_cli_rustdoc.py:60 · its file's page

What it checks (7)

  1. assert db_path.exists() not attributed
  2. assert {"add", "helper", "MAX_RETRIES"} <= names not attributed
  3. assert any(hit.name == "add" for hit in hits) not attributed
  4. assert dossier is not None observes function_dossier via dossier
  5. assert dossier.file == "src/main.rs" observes function_dossier via dossier
  6. assert dossier.brief == "Adds two numbers together." observes function_dossier via dossier
  7. assert "left + right" in " ".join(dossier.body.lines) observes function_dossier via dossier

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_build_index_against_a_rust_repo_is_queryable→function_dossier

What it reaches

Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.

test_build_index_against_a_rust_repo_is_queryable · 7 checksfunction_dossier_dossier_connsymbol_provenanceREQ-DDB-INDEX-004 · measuredfunction_dossier… 5 calls …is_python_treeREQ-DDB-PIPE-003 · measuredfunction_dossier… 5 calls …_parseable_fileREQ-DDB-PIPE-011 · measuredfunction_dossier… 5 calls …has_languageREQ-DDB-PIPE-012 · measuredfunction_dossierconnectREQ-DDB-QUERY-001 · measuredfunction_dossier_dossier_connunresolved_inbound_for_rowidsREQ-DDB-QUERY-002 · measuredfunction_dossier_dossier_connfunction_candidatesREQ-DDB-QUERY-003 · measuredfunction_dossierREQ-DDB-QUERY-004 · measuredfunction_dossier_dossier_conngates_coveringREQ-DDB-QUERY-006 · measuredfunction_dossierREQ-DDB-QUERY-009 · measuredfunction_dossierREQ-DDB-QUERY-010 · measuredfunction_dossier_dossier_conn_macro_dossierREQ-DDB-QUERY-012 · measured

and 2 more requirement paths, listed below.

Also reaches 58 requirements

Its run touches their code; that is reach, not proof.