test_guard_refuses_a_marker_naming_an_undeclared_mode

Tests › tests/test_flowchart.py

passed Passed in the packaged run.

What this test is for

Why it exists

An inline marker's id is checked against the catalogue like `@fails_when`.

Given

  1. path = tmp_path / "test_add.py"
  2. path.write_text( '"""@brief T."""\n\n\n## @brief Adds.\ndef test_add():\n """@brief A."""\n' " assert add(2, 3) == 5 # fails_when: FM-2\n" " assert add(1, 1) == 2 # fails_when: FM-NOPE\n" )
→

When

  1. config = load_config(tmp_path / "no-such.yaml")
  2. (func,) = parse_source_file(str(path), config)
  3. lines = path.read_text().splitlines()
  4. (bad,) = check_fails_when_markers(func, str(path), lines, {"FM-1", "FM-2"})
→

Then

  1. ✓ bad.message contains "FM-NOPE"
  2. ✓ bad.line equals 8

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.

`main` (clew/guard/main.py) · 42 of 357 steps

… 16 earlier steps

program launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyopt (line 733)optopt (line 705)optmain17. _run → _setup_logging17_setup_logging18. _run → load_config18load_config19. load_config → refuse_doxygen_guard_leftovers19refuse_doxygen_guard_leftovers▶ test enters20. load_config → _fresh_defaults20_fresh_defaults21–22. load_config → read_requirements_section21read_requirements_section +1 more

… 79 steps between

program launcherprogram launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyother filesother filesother filesother filesother filesopt (line 168)optloop (line 647)loopopt (line 786)optopt (line 652)optmain102. gate_exclusion → binary_file102binary_file103. validate_file → parse_source_file103parse_source_file104. parse_source_file → parse_source_file_with_content104parse_source_file_with_content▶ test enters105–109. parse_source_file_with_content → parse_content_for_file105parse_content_for_file +4 more110. parse_content_for_file → language_for_file110language_for_file111–112. language_for_file → language_for_extension111language_for_extension +1 more113. language_for_file → _language_from_config113_language_from_config114. parse_content_for_file → parse_functions114parse_functions115. parse_functions → parse_functions_ts115parse_functions_ts116. parse_functions_ts → get_parser_for_language116get_parser_for_language117. parse_functions_ts → get_language_spec117get_language_spec118–119. parse_functions_ts → _collect_functions118_collect_functions +1 more120. _is_rust_test_item → _rust_attributes120_rust_attributes121. _collect_functions → _enclosing_class_for121_enclosing_class_for122. _enclosing_class_for → _rust_impl_self_type122_rust_impl_self_type123. _collect_functions → _declared_function123_declared_function124–125. _collect_functions → _append_declaration124_append_declaration +1 more

… 1 step between

program launcherprogram launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyother filesother filesother filesother filesother filesloop (line 647)loopopt (line 658)optopt (line 377)optelif (line 379)elifalt (line 380)altopt (line 400)optopt (line 681)optopt (line 683)optalt (line 684)altopt (line 227)opttry (line 241)trymain127–128. _append_declaration → _qualified_enclosing127_qualified_enclosing +1 more129–132. _collect_functions → _resolve_function_node129_resolve_function_node +3 more133. _extract_function_name → _name_from_declarator133_name_from_declarator134–137. _collect_functions → _function_carrier134_function_carrier +3 more138–139. _find_preceding_doxygen → _collect_rust_doc138_collect_rust_doc +1 more140. _find_preceding_doxygen → _collect_python_comments140_collect_python_comments141–142. _find_preceding_doxygen → _collect_c_comment141_collect_c_comment +1 more143. _find_preceding_doxygen → parse_doxygen_tags143parse_doxygen_tags144. _find_preceding_doxygen → apply_autobrief144apply_autobrief145. _find_preceding_doxygen → _last_row145_last_row146–149. _collect_functions → _qualified_enclosing146_qualified_enclosing +3 more150. _js_returns_void → _function_carrier150_function_carrier151. _collect_functions → _produced_class151_produced_class152. _produced_class → _function_carrier152_function_carrier153. _collect_functions → _collect_functions153_collect_functions154. _collect_functions → _collect_functions154_collect_functions155. validate_file → unconfigured_language155unconfigured_language156. validate_file → check_file_presence156check_file_presence

… 6 steps between

program launcherprogram launcherprogram launcherprogram launcherclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyother filesother filesother filesother filesopt (line 1198)optloop (line 143)looploop (line 146)loopelif (line 153)elifopt (line 1171)optloop (line 181)loopmain163. _extract_file_block_text → _docstring_block163_docstring_block164. _check_file_block_tags → parse_doxygen_tags164parse_doxygen_tags165–168. parse_doxygen_tags → _mask_escaped_at165_mask_escaped_at +3 more169. parse_doxygen_tags → _finalize_tag169_finalize_tag170. parse_doxygen_tags → _finalize_tag170_finalize_tag171. _check_file_block_tags → apply_autobrief171apply_autobrief172. apply_autobrief → _mask_escaped_at172_mask_escaped_at

… 53 steps between

program launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyother filesother filesother filesother filesloop (line 252)loopopt (line 260)optloop (line 1096)loopopt (line 265)optmain226. validate_file → check_fails_when_exists226check_fails_when_exists227. validate_file → check_fails_when_markers227check_fails_when_markers228. check_fails_when_markers → marker228marker▶ test enters229. validate_file → get_file_at_revision229get_file_at_revision230. get_file_at_revision → run_git230run_git

… 127 later steps

tests/test_flowchart.py:65 · its file's page

What it checks (1)

  1. assert "FM-NOPE" in bad.message and bad.line == 8 not attributed

Where the product reaches it

  • main → _run → run_precommit → _validate_files → validate_file → check_fails_when_markers (flow)
  • main → _run → load_config (flow)
  • main → _run → run_precommit → _validate_files → validate_file → parse_source_file (flow)

Call flow

test_guard_refuses_a_marker_naming_an_undeclared_mode→load_config→parse_source_file→check_fails_when_markers

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_guard_refuses_a_marker_naming_an_undeclared_mode · 1 checkscheck_fails_when_markersREQ-DDB-GUARD-001 · measuredload_configREQ-DDB-GUARD-012 · measuredparse_source_fileparse_source_file_with_contentparse_content_for_fileget_language_configREQ-DDB-GUARD-013 · measuredparse_source_fileREQ-DDB-GUARD-018 · measuredparse_source_file… 6 calls …parse_doxygen_tagsREQ-DDB-GUARD-019 · measuredparse_source_fileparse_source_file_with_contentparse_content_for_filelanguage_for_fileREQ-DDB-GUARD-020 · measuredparse_source_file… 6 calls …_find_python_docstring_blockREQ-DDB-GUARD-021 · inferredload_configapply_opt_in_languagesREQ-DDB-GUARD-024 · inferredparse_source_file… 5 calls …_js_returns_voidREQ-DDB-GUARD-025 · measured
Also reaches 9 requirements

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