基线测试驱动
(类来自 pyomo.common.unittest)
- class pyomo.common.unittest.BaselineTestDriver(test)[source]
基础类:
object用于批量执行基线测试的通用驱动程序
这个测试驱动程序最初是为测试Pyomo书中的示例而设计的,后来被推广用于测试在线文档中的“.. literalinclude:”示例。
我们期望这个类的使用者将从这个类和pyomo.common.unittest.TestCase派生,然后使用parameterized来声明调用
python_test_driver()或shell_test_driver()方法的测试。请注意,派生类必须声明两个类属性:
类属性
solver_dependencies: Dict[str, List[str]]
将测试名称映射到所需的求解器列表。如果任何求解器不可用,则测试将被跳过。
package_dependencies: Dict[str, List[str]]
将测试名称映射到所需模块的列表。如果任何模块不可用,则测试将被跳过。
方法
__init__(test)check_skip(name)如果测试应该被跳过,则返回一个布尔值
compare_baseline(test_output, baseline[, ...])custom_name_func(test_func, test_num, ...)filter_fcn(line)在将输出与基线进行比较时忽略某些文本
filter_file_contents(lines[, abstol])gather_tests(test_dirs)initialize_dependencies()python_test_driver(tname, test_file, base_file)shell_test_driver(tname, test_file, base_file)成员文档