测试copier模板
项目描述
copier-template-tester
参数化copier模板以测试语法错误,检查预期输出,并检查与copier版本的一致性。
请注意,ctt
仅测试copier copy
操作,并不检查update
行为以及模板可能包含的任何特定版本逻辑,因为这些测试很快就会变得复杂。
用法
配置文件
当创建copier模板存储库时,我建议遵循嵌套的"子目录"方法,以便目录看起来像这样
└── template_dir
│ └── {{ _copier_conf.answers_file }}.jinja
├── README.md
├── copier.yml
└── ctt.toml
在您的copier存储库的顶级目录中创建一个新的ctt.toml
文件。填充文件,使其看起来像以下示例。
# Specify shared data across all 'output' destinations
# Note that the copier.yml defaults are used whenever the key is not set in this file
[defaults]
project_name = "placeholder"
copyright_year = 2022
# Parametrize each output with a relative path and optionally any values to override
[output.".ctt/defaults"]
[output.".ctt/no_all"]
package_name = "testing-no-all"
include_all = false
预提交钩子
首先,将此部分添加到您的.pre-commit-config.yml
文件中
repos:
- repo: https://github.com/KyleKing/copier-template-tester
rev: main
hooks:
- id: copier-template-tester
安装并更新到最新版本
pre-commit autoupdate
使用pre-commit
运行
pre-commit run --all-files copier-template-tester
pipx
您还可以通过使用pipx
安装来将ctt
作为CLI工具使用
pipx install copier-template-tester
cd ~/your/copier/project
ctt
更多示例
项目状态
请参阅Open Issues
和/或CODE_TAG_SUMMARY。有关发行历史,请参阅CHANGELOG。
贡献
我们欢迎提交拉取请求!为了使您的拉取请求能够顺利接受,我们建议您首先在GitHub上创建一个issue来讨论您的想法。有关开始使用代码库的资源,请参阅以下文档
行为准则
我们遵循贡献者守则。
开源状态
我们试图合理地满足来自开源洞察的“OpenSSF评分卡”的大部分内容。
负责任披露
如果您有任何安全问题要报告,请私下联系项目维护者。您可以通过dev.act.kyle@gmail.com联系我们。
许可证
关闭
copier_template_tester-2.1.3.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 55a9ba2fb2a13f673b2eb458897148d02ca30582f5e9ef03d5de8a88136d4afb |
|
MD5 | 788693c83efec65bd9c83937db7ae97f |
|
BLAKE2b-256 | 39dfd25730fe1e4db911d10721ab4746c6586b7df53eb8e0c8c118fb4f5b02d3 |
关闭
copier_template_tester-2.1.3-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 416c9fc20efda10e48bcec625db999fb906c56ceb28ff5ff410e6a748bdcf3d0 |
|
MD5 | 5256c7257efa36b781caadf76ae811cb |
|
BLAKE2b-256 | 4d574ec0ce9afc680e7885dfedf79c7cef2ce63648930621245617f69151e5e7 |