cis_interface.tests package

Submodules

cis_interface.tests.test_backwards module

cis_interface.tests.test_backwards.test_as_bytes()[source]

Test as_bytes.

cis_interface.tests.test_backwards.test_as_str()[source]

Test as_str.

cis_interface.tests.test_backwards.test_as_unicode()[source]

Test as_unicode.

cis_interface.tests.test_backwards.test_assert_bytes()[source]

Ensure that the proper byte types are identified.

cis_interface.tests.test_backwards.test_assert_str()[source]

Ensure that the proper str types are identified.

cis_interface.tests.test_backwards.test_assert_unicode()[source]

Ensure that the proper unicode types are identified.

cis_interface.tests.test_backwards.test_decode_escape()[source]

Test esscape decoding.

cis_interface.tests.test_backwards.test_encode_escape()[source]

Test escape encoding.

cis_interface.tests.test_backwards.test_format_bytes()[source]

Test formating of bytes string.

cis_interface.tests.test_backwards.test_match_stype()[source]

Test string type matching.

cis_interface.tests.test_backwards.test_recurse_conv()[source]

Test error on incorrect type for recurse_conv.

cis_interface.tests.test_config module

cis_interface.tests.test_config.make_temp(fname_base, count=1)[source]

Create temporary copies of same file with different extensions.

cis_interface.tests.test_config.make_temp_multiple()[source]

Create multiple temporary files.

cis_interface.tests.test_config.make_temp_single()[source]

Create single temporary file.

cis_interface.tests.test_config.test_CisConfigParser()[source]

Ensure that get returns proper defaults etc.

cis_interface.tests.test_config.test_cfg_logging()[source]

Test cfg_logging.

cis_interface.tests.test_config.test_find_all()[source]

Test find_all.

cis_interface.tests.test_config.test_locate_file()[source]

Test file location method.

cis_interface.tests.test_config.test_update_config()[source]

Test update_config.

cis_interface.tests.test_platform module

Tests for platform compatiblity.

cis_interface.tests.test_platform.test_os()[source]

Test that only one OS selected.

cis_interface.tests.test_runner module

class cis_interface.tests.test_runner.TestCisRunner(*args, **kwargs)[source]

Bases: cis_interface.tests.CisTestBase

Tests of the CisRunner class.

setup(*args, **kwargs)[source]

Record the number of open comms, threads, and file descriptors.

Parameters:
  • nprev_comm (int, optional) – Number of previous comm channels. If not provided, it is determined to be the present number of default comms.
  • nprev_thread (int, optional) – Number of previous threads. If not provided, it is determined to be the present number of threads.
  • nprev_fd (int, optional) – Number of previous open file descriptors. If not provided, it is determined to be the present number of open file descriptors.
test_createIODriver()[source]

Test createInputDriver and createOutputDriver.

cis_interface.tests.test_runner.test_Arunner_interrupt()[source]

Start a runner then stop it with a keyboard interrupt.

cis_interface.tests.test_runner.test_get_runner()[source]

Use get_runner to start a run.

cis_interface.tests.test_runner.test_runner_error()[source]

Test error on missing yaml.

cis_interface.tests.test_runner.test_runner_terminate()[source]

Start a runner, then stop it early.

cis_interface.tests.test_scanf module

cis_interface.tests.test_scanf.test_scanf()[source]

Test scanf.

cis_interface.tests.test_schema module

cis_interface.tests.test_schema.test_SchemaRegistry()[source]

Test schema registry.

cis_interface.tests.test_schema.test_cdriver2commtype_error()[source]

Test error when invalid driver supplied.

cis_interface.tests.test_schema.test_cdriver2filetype_error()[source]

Test errors in cdriver2filetype.

cis_interface.tests.test_schema.test_create_schema()[source]

Test creating new schema.

cis_interface.tests.test_schema.test_default_schema()[source]

Test getting default schema.

cis_interface.tests.test_schema.test_normalize()[source]

Test normalization of legacy formats.

cis_interface.tests.test_schema.test_standardize()[source]

Test standardize.

cis_interface.tests.test_tests module

class cis_interface.tests.test_tests.TestCisTest(*args, **kwargs)[source]

Bases: cis_interface.tests.CisTestClass

Test errors for uninitialized CisTestClass.

create_instance()[source]

Dummy overload to prevent initialization.

test_description()[source]

Get uninitialized description.

test_import_cls()[source]

Test import class with mod/cls unset.

test_post_teardown_ref()[source]

Test errors on instance ref post teardown.

cis_interface.tests.test_timing module

class cis_interface.tests.test_timing.TestTimedRun(*args, **kwargs)[source]

Bases: cis_interface.tests.test_timing.TimedRunTestBase

Test class for the TimedRun class using existing data.

comm_type = 'ZMQComm'
count

Number of messages to use for tests.

Type:int
language = 'python'
platform = 'Linux'
python_ver = '2.7'
size

Size of messages to use for tests.

Type:int
test_fits()[source]

Test fits to scaling on one platform.

test_json()[source]

Test loading/saving perf data as json.

test_perfjson_to_pandas()[source]

Test perfjson_to_pandas.

test_plot_scaling()[source]

Test plot_scaling corner cases not covered by test_plot_scaling_joint.

test_plot_scaling_joint()[source]

Test plot_scaling_joint.

test_plot_scalings()[source]

Test plot_scalings corner cases on test platform.

test_production_runs()[source]

Test production tests (those used in paper).

test_save()[source]

Test save with/without overwrite.

test_scaling_count()[source]

Test running scaling with number of messages.

test_scaling_size()[source]

Test running scaling with size of messages.

class cis_interface.tests.test_timing.TestTimedRunTemp(*args, **kwargs)[source]

Bases: cis_interface.tests.test_timing.TimedRunTestBase

Test class for the TimedRun class using temporary data.

cleanup_files()[source]

Remove the temporary file if it exists.

description_prefix

String prefix to prepend docstr test message with.

setup(*args, **kwargs)[source]

Cleanup the file if it exists and then reload.

teardown(*args, **kwargs)[source]

Cleanup temporary files before destroying instance.

test_comm_types()[source]

Test different comm types.

test_languages()[source]

Test different combinations of source/destination languages.

test_perf_func()[source]

Test perf_func.

test_run_overwrite()[source]

Test performing a run twice, the second time with ovewrite.

time_run_kwargs

Keyword arguments for time_run.

Type:dict
class cis_interface.tests.test_timing.TestTimedRunTempNoPerf(*args, **kwargs)[source]

Bases: cis_interface.tests.test_timing.TestTimedRunTemp

Test class for the TimedRun class using temporary data without perf.

description_prefix

String prefix to prepend docstr test message with.

dont_use_perf = True
test_comm_types()[source]

Disabled: Test different comm types.

test_languages()[source]

Disabled: Test different combinations of source/destination languages.

test_perf_func()[source]

Disabled: Test perf_func.

class cis_interface.tests.test_timing.TimedRunTestBase(*args, **kwargs)[source]

Bases: cis_interface.tests.CisTestClass

Base test class for the TimedRun class.

check_filename()[source]

Raise a unittest.SkipTest error if the filename dosn’t exist.

comm_type = None
count = 1
dont_use_perf = False
entry_name

Name of the entry for the provided time_run_args.

Type:str
filename

Name of the file where data is stored.

Type:str
get_raw_data()[source]

Get the raw contents of the data file.

inst_args

Arguments for creating a class instance.

Type:list
inst_kwargs

Keyword arguments for creating a class instance.

Type:dict
language = 'c'
max_errors = 5
nrep = 1
platform = None
python_ver = None
size = 1
test_name = 'timed_pipe'
time_run()[source]

Perform a timed run.

time_run_args

Arguments for time_run.

Type:tuple
time_run_kwargs

Keyword arguments for time_run.

Type:dict
cis_interface.tests.test_timing.test_get_source()[source]

Test getting source file for test.

cis_interface.tests.test_timing.test_platform_error()[source]

Test error when test cannot be performed.

cis_interface.tests.test_tools module

class cis_interface.tests.test_tools.TestCisClass(*args, **kwargs)[source]

Bases: cis_interface.tests.CisTestClass

Test basic behavior of CisTestClass.

test_attributes()[source]

Assert that the driver has all of the required attributes.

test_prints()[source]

Test logging at various levels.

test_timeout()[source]

Test functionality of timeout.

cis_interface.tests.test_tools.test_eval_kwarg()[source]

Ensure strings & objects properly evaluated.

cis_interface.tests.test_tools.test_get_installed_comm()[source]

Test get_installed_comm.

cis_interface.tests.test_tools.test_get_installed_lang()[source]

Test get_installed_lang.

cis_interface.tests.test_tools.test_locate_path()[source]

Test file location.

cis_interface.tests.test_tools.test_popen_nobuffer()[source]

Test open of process without buffer.

cis_interface.tests.test_units module

class cis_interface.tests.test_units.TestUnits(*args, **kwargs)[source]

Bases: cis_interface.tests.CisTestBase

Tests for using pint for units.

setup(*args, **kwargs)[source]

Setup, create variables for testing.

test_add_units()[source]

Test add_units.

test_are_compatible()[source]

Test are_compatible.

test_as_unit()[source]

Test as_unit.

test_convert_to()[source]

Test convert_to.

test_get_data()[source]

Test get_data.

test_get_units()[source]

Test get_units.

test_has_units()[source]

Test has_units.

test_is_null_unit()[source]

Test is_null_unit.

test_is_unit()[source]

Test is_unit.

cis_interface.tests.test_yamlfile module

class cis_interface.tests.test_yamlfile.TestYamlComponentError(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error for non-dictionary component.

class cis_interface.tests.test_yamlfile.TestYamlConnection(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection between I/O channels.

class cis_interface.tests.test_yamlfile.TestYamlConnectionError(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error when there is not connection for a model I/O channel.

class cis_interface.tests.test_yamlfile.TestYamlConnectionError_forkin(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error when there is not connection for a fork input channel.

class cis_interface.tests.test_yamlfile.TestYamlConnectionError_readmeth(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error when read_meth is specified for non-file.

class cis_interface.tests.test_yamlfile.TestYamlConnectionError_writemeth(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error when write_meth is specified for non-file.

class cis_interface.tests.test_yamlfile.TestYamlConnectionFork(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection between I/O channels.

class cis_interface.tests.test_yamlfile.TestYamlConnectionInputAsciiFile(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection with AsciiFile.

class cis_interface.tests.test_yamlfile.TestYamlConnectionInputAsciiMap(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection with AsciiMap.

class cis_interface.tests.test_yamlfile.TestYamlConnectionInputAsciiTable(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection with AsciiTable.

class cis_interface.tests.test_yamlfile.TestYamlConnectionInputAsciiTableArray(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection with AsciiTable as array.

class cis_interface.tests.test_yamlfile.TestYamlConnectionInputFile(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection with File.

class cis_interface.tests.test_yamlfile.TestYamlConnectionInputFileReadMethError(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error for invalid read_meth.

class cis_interface.tests.test_yamlfile.TestYamlConnectionInputFileWriteMethError(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error for invalid write_meth.

class cis_interface.tests.test_yamlfile.TestYamlConnectionInputFile_wait(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection with File where wait_for_creation specified.

class cis_interface.tests.test_yamlfile.TestYamlConnectionInputObj(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection with Obj file.

class cis_interface.tests.test_yamlfile.TestYamlConnectionInputPandas(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection with Pandas csv.

class cis_interface.tests.test_yamlfile.TestYamlConnectionInputPickle(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection with Pickle.

class cis_interface.tests.test_yamlfile.TestYamlConnectionInputPly(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection with Ply file.

class cis_interface.tests.test_yamlfile.TestYamlConnectionTranslator(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test connection between I/O channels.

class cis_interface.tests.test_yamlfile.TestYamlDuplicateError(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error when there are two components with the same name.

class cis_interface.tests.test_yamlfile.TestYamlIODatatype(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test specification of datatype via schema.

class cis_interface.tests.test_yamlfile.TestYamlIODrivers(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test full specification of IO drivers.

class cis_interface.tests.test_yamlfile.TestYamlMissingConnArgsError(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error when there is a missing arguments to a connection.

class cis_interface.tests.test_yamlfile.TestYamlMissingConnIOError(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error when there is no model input/output matching connection.

class cis_interface.tests.test_yamlfile.TestYamlMissingConnInputError(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error when there is no model output matching connection input.

class cis_interface.tests.test_yamlfile.TestYamlMissingConnInputFileError(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error when there is no file for missing connection input.

class cis_interface.tests.test_yamlfile.TestYamlMissingIOArgsError_input(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error when there is a missing arguments to an input driver.

class cis_interface.tests.test_yamlfile.TestYamlMissingIOArgsError_output(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error when there is a missing arguments to an output driver.

class cis_interface.tests.test_yamlfile.TestYamlMissingModelArgsError(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBaseError

Test error when there is a missing arguments to a model.

class cis_interface.tests.test_yamlfile.TestYamlModelOnly(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test parsing of different numbers/styles of models.

class cis_interface.tests.test_yamlfile.TestYamlServerClient(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test specification of server/client models.

class cis_interface.tests.test_yamlfile.YamlTestBase(*args, **kwargs)[source]

Bases: cis_interface.tests.CisTestClass

Test base for yamlfile.

contents

Contents of files.

Type:tuple
create_instance()[source]

Disabled: Create a new instance of the class.

get_fname(idx=0)[source]

Path to temporary file.

nfiles

Number of files.

Type:int
setup()[source]

Write contents to temp file.

teardown()[source]

Remove the temporary file if it exists.

test_parse_yaml()[source]

Test successfully reading & parsing yaml.

yaml_env

Environment variable where file path is stored.

Type:str
class cis_interface.tests.test_yamlfile.YamlTestBaseError(*args, **kwargs)[source]

Bases: cis_interface.tests.test_yamlfile.YamlTestBase

Test error for yamlfile.

test_parse_yaml()[source]

Test error reading & parsing yaml.

cis_interface.tests.test_yamlfile.direct_translate(msg)[source]

Test translator that just returns passed message.

cis_interface.tests.test_yamlfile.test_load_yaml_error()[source]

Test error on loading invalid file.

cis_interface.tests.test_yamlfile.test_parse_component_error()[source]

Test errors in parse_component.

Module contents

Testing things.

class cis_interface.tests.IOInfo[source]

Bases: object

Simple class for useful IO attributes.

cis_interface.tests.ErrorClass(base_class, *args, **kwargs)[source]

Wrapper to return errored version of a class.

Parameters:
  • base_class (class) – Base class to use.
  • *args – Additional arguments are passed to the class constructor.
  • **kwargs – Additional keyword arguments are passed to the class constructor.
class cis_interface.tests.CisTestBase(*args, **kwargs)[source]

Bases: unittest.case.TestCase

Wrapper for unittest.TestCase that allows use of setup and teardown methods along with description prefix.

Parameters:
  • description_prefix (str, optional) – String to prepend docstring test message with. Default to empty string.
  • skip_unittest (bool, optional) – If True, the unittest parent class will not be initialized. Defaults to False.
uuid

Random unique identifier.

Type:str
attr_list

List of attributes that should be checked for after initialization.

Type:list
timeout

Maximum time in seconds for timeouts.

Type:float
sleeptime

Time in seconds that should be waited for sleeps.

Type:float
assert_equal(x, y)[source]

Assert that two values are equal.

assert_greater(x, y)[source]

Assert that one value is greater than another.

assert_less_equal(x, y)[source]

Assert that one value is less than or equal to another.

assert_raises(*args, **kwargs)[source]

Assert that a function raises an error.

attr_list = []
check_file(fname, result)[source]

Check that a file exists, is the correct size, and has the correct contents.

Parameters:
  • fname (str) – Full path to the file that should be checked.
  • result (str) – Contents of the file.
check_file_contents(fname, result)[source]

Check that the contents of a file are correct.

Parameters:
  • fname (str) – Full path to the file that should be checked.
  • result (str) – Contents of the file.
check_file_exists(fname)[source]

Check that a file exists.

Parameters:fname (str) – Full path to the file that should be checked.
check_file_size(fname, fsize)[source]

Check that file is the correct size.

Parameters:
  • fname (str) – Full path to the file that should be checked.
  • fsize (int) – Size that the file should be in bytes.
cleanup_comm_classes

Comm classes that should be cleaned up following the test.

Type:list
cleanup_comms()[source]

Cleanup all comms.

comm_count

The number of comms.

Type:int
debug_log()[source]

Turn on debugging.

description_prefix

String prefix to prepend docstr test message with.

fd_count

The number of open file descriptors.

Type:int
reset_default_comm()[source]

Reset the default comm to the original value.

reset_encoding()[source]

Reset the encoding to the original value before the test.

reset_log()[source]

Resetting logging to prior value.

setUp(*args, **kwargs)[source]

Hook method for setting up the test fixture before exercising it.

set_default_comm(default_comm=None)[source]

Set the default comm.

set_utf8_encoding()[source]

Set the encoding to utf-8 if it is not already.

setup(nprev_comm=None, nprev_thread=None, nprev_fd=None)[source]

Record the number of open comms, threads, and file descriptors.

Parameters:
  • nprev_comm (int, optional) – Number of previous comm channels. If not provided, it is determined to be the present number of default comms.
  • nprev_thread (int, optional) – Number of previous threads. If not provided, it is determined to be the present number of threads.
  • nprev_fd (int, optional) – Number of previous open file descriptors. If not provided, it is determined to be the present number of open file descriptors.
shortDescription()[source]

Prefix first line of doc string.

tearDown(*args, **kwargs)[source]

Hook method for deconstructing the test fixture after testing it.

teardown(ncurr_comm=None, ncurr_thread=None, ncurr_fd=None)[source]

Check the number of open comms, threads, and file descriptors.

Parameters:
  • ncurr_comm (int, optional) – Number of current comms. If not provided, it is determined to be the present number of comms.
  • ncurr_thread (int, optional) – Number of current threads. If not provided, it is determined to be the present number of threads.
  • ncurr_fd (int, optional) – Number of current open file descriptors. If not provided, it is determined to be the present number of open file descriptors.
thread_count

The number of active threads.

Type:int
class cis_interface.tests.CisTestClass(*args, **kwargs)[source]

Bases: cis_interface.tests.CisTestBase

Test class for a CisClass.

clear_instance()[source]

Clear the instance.

cls

Class to be tested.

Type:str
create_instance()[source]

Create a new instance of the class.

description_prefix

String prefix to prepend docstr test message with.

get_options()[source]

Get testing options.

import_cls

Import the tested class from its module

inst_args

Arguments for creating a class instance.

Type:list
inst_kwargs

Keyword arguments for creating a class instance.

Type:dict
instance

Instance of the test driver.

Type:object
mod

Absolute name of module containing class to be tested.

Type:str
remove_instance(inst)[source]

Remove an instance of the class.

setup(*args, **kwargs)[source]

Create an instance of the class.

teardown(*args, **kwargs)[source]

Remove the instance.

testing_option_kws = {}
testing_options

Testing options.

Type:dict
class cis_interface.tests.CisTestClassInfo(*args, **kwargs)[source]

Bases: cis_interface.tests.CisTestClass, cis_interface.tests.IOInfo

Test class for a CisClass with IOInfo available.