BaselineTestDriver

(class from pyomo.common.unittest)

class pyomo.common.unittest.BaselineTestDriver(test)[source]

Bases: object

Generic driver for performing baseline tests in bulk

This test driver was originally crafted for testing the examples in the Pyomo Book, and has since been generalized to reuse in testing “.. literalinclude:” examples from the Online Docs.

We expect that consumers of this class will derive from both this class and pyomo.common.unittest.TestCase, and then use parameterized to declare tests that call either the python_test_driver() or shell_test_driver() methods.

Note that derived classes must declare two class attributes:

Class Attributes

solver_dependencies: Dict[str, List[str]]

maps the test name to a list of required solvers. If any solver is not available, then the test will be skipped.

package_dependencies: Dict[str, List[str]]

maps the test name to a list of required modules. If any module is not available, then the test will be skipped.

__init__(test)[source]

Methods

__init__(test)

check_skip(name)

Return a boolean if the test should be skipped

compare_baseline(test_output, baseline[, ...])

custom_name_func(test_func, test_num, ...)

filter_fcn(line)

Ignore certain text when comparing output with baseline

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)

Member Documentation

check_skip(name)[source]

Return a boolean if the test should be skipped

filter_fcn(line)[source]

Ignore certain text when comparing output with baseline