mirror of
https://github.com/K-Dense-AI/scientific-agent-skills.git
synced 2026-12-04 01:24:00 +08:00
fix(tests): ignore cache files when finding script-bearing skills
script_bearing_skills() counted a skill as shipping scripts when anything at all existed under scripts/, including gitignored __pycache__/ left by running a script by hand. A local checkout where parallel-web (which ships no scripts) had a stale scripts/__pycache__/ then failed test_every_skill_with_scripts_has_a_test_suite, even though a clean checkout passes. Count only real files, skipping bytecode, __pycache__ and dotfiles such as .DS_Store. Paths are checked relative to scripts/, so a checkout under a dot-directory is unaffected. On a clean tree the result matches the set of skills with git-tracked scripts (121). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a1043ef544
commit
2aa313a4e0
1 file changed
+17
-2
@@ -82,17 +82,32 @@ def script_bearing_skills(skills_dir: Path = SKILLS_DIR) -> list[Path]:
|
||||
|
||||
An empty `scripts/` directory does not count. Git cannot track empty
|
||||
directories, so one only ever exists as local cruft, and requiring a test
|
||||
suite for a skill that ships no scripts would be nonsense.
|
||||
suite for a skill that ships no scripts would be nonsense. The same goes
|
||||
for a `scripts/` that holds only gitignored leftovers, such as the
|
||||
`__pycache__/` a script run leaves behind or a `.DS_Store`.
|
||||
"""
|
||||
return [
|
||||
skill
|
||||
for skill in sorted(skills_dir.iterdir())
|
||||
if skill.is_dir()
|
||||
and (skill / "SKILL.md").is_file()
|
||||
and any((skill / "scripts").rglob("*"))
|
||||
and _ships_script_files(skill / "scripts")
|
||||
]
|
||||
|
||||
|
||||
def _ships_script_files(scripts: Path) -> bool:
|
||||
"""`scripts/` holds a file that is not bytecode, a cache, or a dotfile."""
|
||||
return any(
|
||||
path.is_file()
|
||||
and path.suffix not in {".pyc", ".pyo"}
|
||||
and not any(
|
||||
part == "__pycache__" or part.startswith(".")
|
||||
for part in path.relative_to(scripts).parts
|
||||
)
|
||||
for path in scripts.rglob("*")
|
||||
)
|
||||
|
||||
|
||||
def all_skill_names(skills_dir: Path = SKILLS_DIR) -> set[str]:
|
||||
return {
|
||||
skill.name
|
||||
|
||||
Reference in new issue
Block a user