test_discover_targets_documents_both_lib_and_same_named_bin

Tests › tests/test_rustdoc.py

passed Passed in the packaged run.

What this test is for

Why it exists

RUSTDOC_INTEGRATION_FEEDBACK.md, finding 1: `knots` and `tools_sqc` both pair a `[lib]` with a same-named `[[bin]]`, and the old lib-instead-of-bin selection silently dropped every module reachable only from the bin (`main.rs`, CLI parsing, config loading, output formatting) with no error — `cargo metadata` succeeds either way, so nothing in the build log said a target was skipped. This crate reproduces that exact shape and asserts both targets come back.

Given

  1. if shutil.which("cargo") is None: pytest.skip("needs cargo")
  2. (tmp_path / "Cargo.toml").write_text( '[package]\nname = "dual"\nversion = "0.1.0"\nedition = "2021"\n\n' '[lib]\nname = "dual"\n\n[[bin]]\nname = "dual"\npath = "src/main.rs"\n', encoding="utf-8", )
4 more
  1. src = tmp_path / "src"
  2. src.mkdir()
  3. (src / "lib.rs").write_text("pub fn helper() {}\n", encoding="utf-8")
  4. (src / "main.rs").write_text("fn main() {}\n", encoding="utf-8")
→

When

  1. targets = _discover_targets(tmp_path)
  2. kinds = {(t.name, t.kind) for t in targets}
→

Then

  1. ✓ kinds equals {("dual", "lib"), ("dual", "bin")}

tests/test_rustdoc.py:193 · its file's page

What it checks (1)

  1. assert kinds == {("dual", "lib"), ("dual", "bin")}, ( f"a package with both a lib and a same-named bin must document both; got {kinds}" ) not attributed

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_discover_targets_documents_both_lib_and_same_named_bin→_discover_targets

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_discover_targets_documents_both_lib_and_same_named_bin · 1 checks_discover_targetsclean_subprocess_envREQ-DDB-PIPE-006 · measured
Also reaches 1 requirement

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