CI-18: selector carries a change through a test that imports another test
A test first reached as text (a pattern reader) was never expanded again when a later path reached it by import, so a test importing it was missed. Expanded and reached are now tracked apart; the empty diff selects the safety set. Test added. Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bdqr7PiaHcBnzPituu2yTC
This commit is contained in:
co-authored by
Claude
parent
17b65785b7
commit
b2d3066966
@@ -81,6 +81,9 @@ mk(R, {
|
||||
# reader, not a dependency of anything that imports a module
|
||||
P + "test_reader.py": "import glob\nfor f in glob.glob('test_*.py'):\n open(f).read()\n",
|
||||
P + "test_unrelated.py": "print('x')\n",
|
||||
# a test imported by another test carries the change on (an import runs it)
|
||||
P + "test_base.py": "from app import lonely\n",
|
||||
P + "test_chain.py": "import test_base\n",
|
||||
})
|
||||
n, why = choose(R, [P + "app/low.py"])
|
||||
check("a change two imports down chooses the test that imports the top (transitive)",
|
||||
@@ -89,6 +92,9 @@ check("...and not tests that do not reach it",
|
||||
n is not None and not {"test_b.py", "test_c.py", "test_unrelated.py"} & set(n))
|
||||
n, why = choose(R, [P + "app/lonely.py"])
|
||||
check("a direct importer is chosen", n is not None and "test_b.py" in n)
|
||||
check("a test that imports another test is chosen with it, even though "
|
||||
"test_reader (a pattern reader) also reaches test_base as text",
|
||||
n is not None and "test_chain.py" in n and "test_base.py" in n)
|
||||
n, why = choose(R, [P + "tools/launched.py"])
|
||||
check("a tool launched by path in a string chooses the launching test",
|
||||
n is not None and "test_c.py" in n)
|
||||
|
||||
Reference in New Issue
Block a user