compass.TestCase¶
- class compass.TestCase(test_group, name, subdir=None)[source]¶
The base class for test cases—such as a decomposition, threading or restart test—that are made up of one or more steps
- Variables
name (str) – the name of the test case
test_group (compass.TestGroup) – The test group the test case belongs to
mpas_core (compass.MpasCore) – The MPAS core the test group belongs to
steps (dict) – A dictionary of steps in the test case with step names as keys
steps_to_run (list) – A list of the steps to run when
run()
gets called. This list includes all steps by default but can be replaced with a list of only those tests that should run by default if some steps are optional and should be run manually by the user.subdir (str) – the subdirectory for the test case
path (str) – the path within the base work directory of the test case, made up of
mpas_core
,test_group
, and the test case’ssubdir
config (compass.config.CompassConfigParser) – Configuration options for this test case, a combination of the defaults for the machine, core and configuration
config_filename (str) – The local name of the config file that
config
has been written to during setup and read from during runwork_dir (str) – The test case’s work directory, defined during setup as the combination of
base_work_dir
andpath
base_work_dir (str) – The base work directory
baseline_dir (str, optional) – Location of the same test case within the baseline work directory, for use in comparing variables and timers
stdout_logger (logging.Logger) – A logger for output from the test case that goes to stdout regardless of whether
logger
is a log file or stdoutlogger (logging.Logger) – A logger for output from the test case
log_filename (str) – At run time, the name of a log file where output/errors from the test case are being logged, or
None
if output is to stdout/stderrnew_step_log_file (bool) – Whether to create a new log file for each step or to log output to a common log file for the whole test case. The latter is used when running the test case as part of a test suite
validation (dict) – A dictionary with the status of internal and baseline comparisons, used by the
compass
framework to determine whether the test case passed or failed internal and baseline validation.
- __init__(test_group, name, subdir=None)[source]¶
Create a new test case
- Parameters
test_group (compass.TestGroup) – the test group that this test case belongs to
name (str) – the name of the test case
subdir (str, optional) – the subdirectory for the test case. The default is
name
Methods
__init__
(test_group, name[, subdir])Create a new test case
add_step
(step[, run_by_default])Add a step to the test case
check_validation
()Check the test case's "validation" dictionary to see if validation failed.
Modify the configuration options for this test case.
run
()Run each step of the test case.
validate
()Test cases can override this method to perform validation of variables and timers