test: check the domain layer against sys.stdlib_module_names
The layering test pinned an exact import set, so any new stdlib import in skills/issue tripped it — 'collections', added by issue_ac.py, did. Assert the rule AGENTS.md actually states (stdlib only, never subprocess) instead of a frozen snapshot of it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -425,9 +425,11 @@ class TestLayering(unittest.TestCase):
|
||||
for line in f:
|
||||
if line.startswith(("import ", "from ")):
|
||||
imported.add(line.split()[1].split(".")[0])
|
||||
local = {"issue", "issue_index"}
|
||||
self.assertEqual(imported - local, {"argparse", "os", "re", "sys"},
|
||||
"non-stdlib or unexpected import in the domain layer")
|
||||
local = {"issue", "issue_ac", "issue_index"}
|
||||
foreign = imported - local - sys.stdlib_module_names
|
||||
self.assertEqual(foreign, set(),
|
||||
"non-stdlib import in the domain layer: %s"
|
||||
% ", ".join(sorted(foreign)))
|
||||
self.assertNotIn("subprocess", imported)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user