用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Levizor/nix-scribe --skill module-testing命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | module-testing |
| description | Guide and patterns for writing unit tests for nix-scribe parsers and modules using pytest tmp_path fixtures. |
All nix-scribe tests must be filesystem-backed using pytest's tmp_path fixture.
tmp_path Fixture: Always build the target mock directory layout inside tmp_path.os.path.exists, open, Path.read_text).context.systemctl.is_enabled).tests/modules/test_my_module.py)from nix_scribe.lib.context import SystemContext
from nix_scribe.lib.option_block import ConfigFragment
from nix_scribe.modules.category.my_module import my_module
MOCK_CONFIG = """
# /etc/my_service/config.conf
setting_name = my_value
"""
def test_my_module_scanner_empty(tmp_path):
context = SystemContext(tmp_path)
ir = my_module.scan(context)
assert ir == {}
def test_my_module_scanner_with_files(tmp_path):
conf_dir = tmp_path / "etc/my_service"
conf_dir.mkdir(parents=True)
(conf_dir / "config.conf").write_text(MOCK_CONFIG)
context = SystemContext(tmp_path)
ir = my_module.scan(context)
assert ir["enable"] is True
assert ir["settingName"] == "my_value"
def test_my_module_mapper():
assert my_module.map
mock_ir = {"enable": True, "settingName": "custom_val"}
block = my_module.map(mock_ir)
assert isinstance(block, ConfigFragment)
data = block["services.myService"]
assert data["enable"] is True
assert data["settingName"] == "custom_val"
def test_my_module_mapper_empty():
assert my_module.map(None) is None
assert my_module.map({}) is None
Before finalizing changes:
direnv exec . ruff check --fix
direnv exec . ruff format
direnv exec . pytest