递归查找您的包中的测试
项目描述
简介
chaoflow.testing.crawler的目的是查找您的包中的测试,并运行与您显式定义的文件中的测试。
测试将在以下文件中找到
您的包(子包)中所有.py文件,即您可以导入的文件
所有具有相应.py文件的.txt文件
您显式指定的所有文件
所有找到的测试都可以单独运行,例如使用zc.recipe.testrunner。
使用测试爬虫
为了在您的包中使用测试爬虫,您只需复制一个文件并在setup.py中声明chaoflow.testing.crawler的依赖关系。
将此文件放入您的包根目录中,并调整文件列表以显式指定其他找不到的测试文件,tests.py
# chaoflow.testing.crawler.tests.py # # You can simply copy this file to your package and adjust it to your needs from chaoflow.testing.crawler import create_test_suite # File to test, relative to the package root # all .py files are found # all .txt files with corresponding .py file are found files = [ 'README.txt' ] # We assume that this modules is in the root of your package pkgname = __name__[:-6] test_suite = create_test_suite(pkgname, files)
在setup.py中声明依赖关系
setup(... extras_require={ 'test': [ 'interlude', 'chaoflow.testing.ipython', 'chaoflow.testing.crawler', ], }, )
如果interlude可用,interlude.interact将作为interact在您的测试环境中可用。
如果chaoflow.testing.ipython可用,ipshell将作为ipshell在您的测试环境中可用。
使用chaoflow.testing.crawler和zc.recipe.testrunner的示例buildout.cfg
[buildout] develop = . parts = test py [test] recipe = zc.recipe.testrunner eggs = chaoflow.testing.crawler [test] [py] recipe = zc.recipe.egg interpreter = py eggs = ${test:eggs}
构建完成后,您可以使用 ./bin/test 运行测试。运行 ./bin/test --list-tests 获取所有已注册测试的列表,并查看 ./bin/test --help 获取更多信息。
许可证
chaoflow.testing.crawler 采用 LGPLv3 许可。如果这给您带来问题,请告知我。
变更日志
项目详情
关闭
chaoflow.testing.crawler-0.5.zip 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 9880738483b8f8da86a1015215bcdf806679c70f5eb30b2cdc1be9a03b9004e0 |
|
MD5 | 5e2327c71b8807b76561dc71511d3c30 |
|
BLAKE2b-256 | 466881813c411eb4e40359b9dfd01b0e334f72a259911a370d229d2132f76c62 |