为使用ConfTools处理其配置的项目提供的测试工具。
项目描述
[](https://circleci.com/gh/AndreaCensi/comptests)
comptests
=========
基于[ConfTools][conftools]、[CompMake][compmake]和[QuickApp][quickapp]构建的测试工具。
基本用法
-----------
这是使用[ConfTools][conftools]注册对象的软件包的用法。
定义测试
调用函数 ``comptests_for_all`` 创建装饰器
获取库(ObjSpec)
library_robots = get_conftools_robots()
创建测试装饰器
for_all_robots = comptests_for_all(library_robots)
使用装饰器指定测试。测试函数
必须接受两个参数:id对象和对象本身
@for_all_robots
def check_robot_type(id_robot, robot)
assert isinstance(robot, RobotInterface)
您也可以为成对的对象注册测试
library_nuisances = get_conftools_nuisances()
for_all_robot_nuisance_pairs = comptests_for_all_pairs(library_robots, library_nuisances)
@for_all_robot_nuisance_pairs
def check_nuisances_obs(id_robot, robot, id_nuisance, nuisance)
check_conversions(robot.get_spec().get_observations(), nuisance)
运行测试
使用命令行
comptests <module>
This looks for the ``get_comptests()`` function in ``<module>``
def get_comptests()
get_comptests()
获取测试配置目录
from pkg_resources import resource_filename
dirname = resource_filename("boot_agents", "configs")
加载unittests
from . import unittests
from comptests import get_comptests_app
获取boot_config的Quickapp
app = get_comptests_app(get_boot_config())
return [app]
查找覆盖率信息
============================
将 ``coverage`` 工具与comptests一起使用非常有用。
安装 ``coverage`` 工具
pip install coverage
如果已安装“coverage”,则comptests将自动计算
nosetests执行的覆盖率信息。
要为comptests计算覆盖率信息,请按照以下方式运行
coverage run =comptests -c "make recurse=1" <package>
注意,您不能使用并行测试(使用“parmake”)否则
覆盖率将产生混淆。
这将显示结果
coverage report -m
然后创建HTML报告
coverage html -d outdir
comptests
=========
基于[ConfTools][conftools]、[CompMake][compmake]和[QuickApp][quickapp]构建的测试工具。
基本用法
-----------
这是使用[ConfTools][conftools]注册对象的软件包的用法。
定义测试
调用函数 ``comptests_for_all`` 创建装饰器
获取库(ObjSpec)
library_robots = get_conftools_robots()
创建测试装饰器
for_all_robots = comptests_for_all(library_robots)
使用装饰器指定测试。测试函数
必须接受两个参数:id对象和对象本身
@for_all_robots
def check_robot_type(id_robot, robot)
assert isinstance(robot, RobotInterface)
您也可以为成对的对象注册测试
library_nuisances = get_conftools_nuisances()
for_all_robot_nuisance_pairs = comptests_for_all_pairs(library_robots, library_nuisances)
@for_all_robot_nuisance_pairs
def check_nuisances_obs(id_robot, robot, id_nuisance, nuisance)
check_conversions(robot.get_spec().get_observations(), nuisance)
运行测试
使用命令行
comptests <module>
This looks for the ``get_comptests()`` function in ``<module>``
def get_comptests()
get_comptests()
获取测试配置目录
from pkg_resources import resource_filename
dirname = resource_filename("boot_agents", "configs")
加载unittests
from . import unittests
from comptests import get_comptests_app
获取boot_config的Quickapp
app = get_comptests_app(get_boot_config())
return [app]
查找覆盖率信息
============================
将 ``coverage`` 工具与comptests一起使用非常有用。
安装 ``coverage`` 工具
pip install coverage
如果已安装“coverage”,则comptests将自动计算
nosetests执行的覆盖率信息。
要为comptests计算覆盖率信息,请按照以下方式运行
coverage run =comptests -c "make recurse=1" <package>
注意,您不能使用并行测试(使用“parmake”)否则
覆盖率将产生混淆。
这将显示结果
coverage report -m
然后创建HTML报告
coverage html -d outdir
项目详情
关闭
comptests-1.4.34.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 09bf3a2e3b062879add62c62f3afb454f22474823992b3a8a9549af21614062d |
|
MD5 | 6e61a856d2d11ba84bef53193af4ee37 |
|
BLAKE2b-256 | 7c1f79709787695701063936731f9a0519268ed453d8a3b36c19bb2c944f222c |