UNIX命令行工具,用于bash/shell工具单元测试
项目描述
作者: Pahaz Blinov
仓库: https://github.com/pahaz/bashtest/
BashTest是用于测试bash/shell工具的UNIX命令行工具。
这是编写简单的bash测试的最简单方式。
要求:Python2或Python3
关键词:bash单元测试,单元测试,bash测试,sh单元测试
安装
bashtest已在PyPI上,所以只需运行
pip install bashtest
或
easy_install bashtest
即可将其安装到您的环境中。
从源安装时,克隆仓库并运行
python setup.py install
如果您没有pip,可以安装它
典型用例
您有一个命令行工具或bash/sh脚本,并希望对其进行测试。
例如,我们想测试ls工具。
我们需要的只是一个包含执行日志的文本文件。
./test_ls.bashtest
$ ls ./testsuit/list-directory file1 file2.txt file3.py file4.sh
运行这些测试
$ bashtest test_ls.bashtest 1 items passed all tests: 1 tests in test_ls.bashtest 1 tests in 1 items. 1 passed and 0 failed. Test passed.
测试README示例
您有一些类似的开源项目。当然,像任何优秀的开源项目一样,您都有示例。您可以自动检查这些示例。只需在您的CI测试中添加 bashtest README.rst。
更多示例
您可以在本项目中找到一些示例。请检查 test_*.bashtest 文件
变更日志
- ** 0.0.8 **
添加 #skipbashtest 支持
- ** 0.0.7 **
- ** 0.0.6 **
修复!命令转义错误 #5
帮助
$ bashtest --help
usage: bashtest [-h] [--exitcode] [-v] [-q] [--debug] [--version]
[file [file ...]]
BashTest is a UNIX command-line tool for running text-based bash tests.
positional arguments:
file Input file (by default uses *.bashtest)
optional arguments:
-h, --help show this help message and exit
--exitcode Print exitcode after command end of output
-v, --verbose Verbose output mode
-q, --quiet Silent output mode
--debug Print the debug information
--version Print the version string
项目详情
关闭
bashtest-0.0.8.tar.gz 的哈希
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 7c194655e0577dcc496d4433c7703c34e4a03c66b839945d0eefcfa4bef8a0c6 |
|
| MD5 | 804fda3e78a691793716a62c715a3762 |
|
| BLAKE2b-256 | e2ff792afee801b74f7d7eb4cae5ac9caadbd4d24fba7516718125266553581a |