test_console_script_seed_resolves_the_declared_module¶
Tests › tests/test_python_ast.py
What this test is for
Why it exists
clew declares two entry points that share the bare name `main`. The seed must resolve against the fully dotted `definition`, so a declared `pkg.cli:main` seeds cli's `main` and not the other one.
Given
db = tmp_path / "clew.db"conn = sqlite3.connect(str(db))
5 more
conn.executescript( """ CREATE TABLE path (name TEXT); CREATE TABLE memberdef ( rowid INTEGER PRIMARY KEY, kind TEXT, name TEXT, definition TEXT, file_id INTEGER, bodyfile_id INTEGER, bodystart INTEGER, bodyend INTEGER ); """, )conn.executemany( "INSERT INTO memberdef (rowid, kind, name, definition, file_id, bodyfile_id, " "bodystart, bodyend) VALUES (?, 'function', 'main', ?, 1, 1, 1, 2)", [(1, "None pkg.cli.main"), (2, "None pkg.server.main")], )conn.commit()conn.close()(tmp_path / "pyproject.toml").write_text('[project.scripts]\nx = "pkg.cli:main"\n')
When
seeds = python_entry_seeds(db, tmp_path)
Then
- ✓ seeds equals {1}
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.
Build this wiki from the index · 4 of 400 steps
… 94 earlier steps
… 298 later steps
1 more
- `main` (clew/guard/main.py) · 1 of 357 steps
tests/test_python_ast.py:630 · its file's page
What it checks (1)
assert seeds == {1}, "console script resolved to the wrong same-named function"observespython_entry_seedsviaseeds
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
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.
Also reaches 4 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-PIPE-003 measured
- REQ-DDB-PIPE-004 measured
- REQ-DDB-PIPE-011 inferred
- REQ-DDB-PIPE-012 inferred