test_console_script_seed_resolves_the_declared_module

Tests › tests/test_python_ast.py

passed Passed in the packaged run.

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

  1. db = tmp_path / "clew.db"
  2. conn = sqlite3.connect(str(db))
5 more
  1. 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 ); """, )
  2. 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")], )
  3. conn.commit()
  4. conn.close()
  5. (tmp_path / "pyproject.toml").write_text('[project.scripts]\nx = "pkg.cli:main"\n')
→

When

  1. seeds = python_entry_seeds(db, tmp_path)
→

Then

  1. ✓ 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

callercallercallercallerother filesother filesother filesother filesloop (line 43)looploop (line 223)looploop (line 224)looploop (line 74)looploop (line 78)loopbuild_wiki95–96. entry_point_flows → _scripts95_scripts +1 more97. console_scripts → _read_toml97_read_toml▶ test enters98–99. _read_toml → require_toml_module98require_toml_module +1 more100. console_scripts → _nested100_nested101. _scripts → _defined101_defined102. entry_point_flows → _mains102_mains

… 298 later steps

1 more

tests/test_python_ast.py:630 · its file's page

What it checks (1)

  1. assert seeds == {1}, "console script resolved to the wrong same-named function" observes python_entry_seeds via seeds

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_console_script_seed_resolves_the_declared_module→python_entry_seeds

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_console_script_seed_resolves_the_declared_module · 1 checkspython_entry_seedsrun_harvestREQ-DDB-PIPE-003 · measuredpython_entry_seedsREQ-DDB-PIPE-004 · measuredpython_entry_seedsrun_harvest_harvest_one_file_parseable_fileREQ-DDB-PIPE-011 · inferredpython_entry_seeds… 4 calls …has_languageREQ-DDB-PIPE-012 · inferred
Also reaches 4 requirements

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