CIME.tests package

Submodules

CIME.tests.base module

class CIME.tests.base.BaseTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

FAST_ONLY = None
GLOBAL_TIMEOUT = None
MACHINE = None
NO_BATCH = None
NO_CMAKE = None
NO_FORTRAN_RUN = None
NO_TEARDOWN = None
SCRIPT_DIR = '/home/titters/devel/E3SM/cime/master/scripts'
TEST_COMPILER = None
TEST_MPILIB = None
TEST_ROOT = None
TOOLS_DIR = '/home/titters/devel/E3SM/cime/master/scripts/Tools'
assert_dashboard_has_build(build_name, expected_count=1)[source]
assert_test_status(test_name, test_status_obj, test_phase, expected_stat)[source]
get_casedir(case_fragment, all_cases)[source]
kill_python_subprocesses(sig=Signals.SIGKILL, expected_num_killed=None)[source]
kill_subprocesses(name=None, sig=Signals.SIGKILL, expected_num_killed=None)[source]
run_cmd_assert_result(cmd, from_dir=None, expected_stat=0, env=None, verbose=False)[source]
setUp()[source]

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

setup_proxy()[source]
tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

verify_perms(root_dir)[source]
CIME.tests.base.typed_os_environ(key, default_value, expected_type=None)[source]

CIME.tests.case_fake module

This module contains a fake implementation of the Case class that can be used for testing the tests.

class CIME.tests.case_fake.CaseFake(case_root, create_case_root=True)[source]

Bases: object

case_setup(clean=False, test_mode=False, reset=False)[source]
copy(newcasename, newcaseroot)[source]

Create and return a copy of self, but with CASE and CASEBASEID set to newcasename, CASEROOT set to newcaseroot, and RUNDIR set appropriately.

Args:

newcasename (str): new value for CASE newcaseroot (str): new value for CASEROOT

create_clone(newcase, keepexe=False, mach_dir=None, project=None, cime_output_root=None, exeroot=None, rundir=None)[source]

Create a clone of the current case. Also creates the CASEROOT directory for the clone case (given by newcase).

Args:
newcase (str): full path to the new case. This directory should not

already exist; it will be created

keepexe (bool, optional): Ignored mach_dir (str, optional): Ignored project (str, optional): Ignored cime_output_root (str, optional): New CIME_OUTPUT_ROOT for the clone exeroot (str, optional): New EXEROOT for the clone rundir (str, optional): New RUNDIR for the clone

Returns the clone case object

flush()[source]
get_value(item)[source]

Get the value of the given item

Returns None if item isn’t set for this case

Args:

item (str): variable of interest

load_env(reset=False)[source]
make_rundir()[source]

Make directory given by RUNDIR

set_exeroot()[source]

Assumes CASEROOT is already set; sets an appropriate EXEROOT (nested inside CASEROOT)

set_initial_test_values()[source]
set_rundir()[source]

Assumes CASEROOT is already set; sets an appropriate RUNDIR (nested inside CASEROOT)

set_value(item, value)[source]

Set the value of the given item to the given value

Args:

item (str): variable of interest value (any type): new value for item

CIME.tests.custom_assertions_test_status module

This module contains a class that extends unittest.TestCase, adding custom assertions that can be used when testing TestStatus.

class CIME.tests.custom_assertions_test_status.CustomAssertionsTestStatus(methodName='runTest')[source]

Bases: unittest.case.TestCase

assert_core_phases(output, test_name, fails)[source]

Asserts that ‘output’ contains a line for each of the core test phases for the given test_name. All results should be PASS except those given by the fails list, which should be FAILS.

assert_num_expected_unexpected_fails(output, num_expected, num_unexpected)[source]

Asserts that the number of occurrences of expected and unexpected fails in ‘output’ matches the given numbers

assert_phase_absent(output, phase, test_name)[source]

Asserts that ‘output’ does not contain a status line for the given phase and test_name

assert_status_of_phase(output, status, phase, test_name, xfail=None)[source]

Asserts that ‘output’ contains a line showing the given status for the given phase for the given test_name.

‘xfail’ should have one of the following values: - None (the default): assertion passes regardless of whether there is an

EXPECTED/UNEXPECTED string

  • ‘no’: The line should end with the phase, with no additional text after that

  • ‘expected’: After the phase, the line should contain ‘(EXPECTED FAILURE)’

  • ‘unexpected’: After the phase, the line should contain ‘(UNEXPECTED’

CIME.tests.scripts_regression_tests module

Script containing CIME python regression test suite. This suite should be run to confirm overall CIME correctness.

CIME.tests.scripts_regression_tests.cleanup(test_root)[source]
CIME.tests.scripts_regression_tests.configure_tests(timeout, no_fortran_run, fast, no_batch, no_cmake, no_teardown, machine, compiler, mpilib, test_root, **kwargs)[source]
CIME.tests.scripts_regression_tests.setup_arguments(parser)[source]
CIME.tests.scripts_regression_tests.write_provenance_info(machine, test_compiler, test_mpilib, test_root)[source]

CIME.tests.test_sys_bless_tests_results module

class CIME.tests.test_sys_bless_tests_results.TestBlessTestResults(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

setUp()[source]

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

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_bless_test_results()[source]
test_rebless_namelist()[source]

CIME.tests.test_sys_build_system module

class CIME.tests.test_sys_build_system.TestBuildSystem(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

test_clean_rebuild()[source]

CIME.tests.test_sys_cime_case module

class CIME.tests.test_sys_cime_case.TestCimeCase(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

test_case_clean()[source]
test_case_submit_interface()[source]
test_cime_case()[source]
test_cime_case_allow_failed_prereq()[source]
test_cime_case_build_threaded_1()[source]
test_cime_case_build_threaded_2()[source]
test_cime_case_force_pecount()[source]
test_cime_case_mpi_serial()[source]
test_cime_case_prereq()[source]
test_cime_case_resubmit_immediate()[source]
test_cime_case_st_archive_resubmit()[source]
test_cime_case_test_custom_project()[source]
test_cime_case_test_walltime_mgmt_1()[source]
test_cime_case_test_walltime_mgmt_2()[source]
test_cime_case_test_walltime_mgmt_3()[source]
test_cime_case_test_walltime_mgmt_4()[source]
test_cime_case_test_walltime_mgmt_5()[source]
test_cime_case_test_walltime_mgmt_6()[source]
test_cime_case_test_walltime_mgmt_7()[source]
test_cime_case_test_walltime_mgmt_8()[source]
test_cime_case_xmlchange_append()[source]
test_configure()[source]
test_create_test_longname()[source]
test_env_loading()[source]
test_self_build_cprnc()[source]
test_xml_caching()[source]

CIME.tests.test_sys_cime_performance module

class CIME.tests.test_sys_cime_performance.TestCimePerformance(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

test_cime_case_ctrl_performance()[source]

CIME.tests.test_sys_cmake_macros module

class CIME.tests.test_sys_cmake_macros.TestCMakeMacros(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

CMake macros tests.

This class contains tests of the CMake output of Build.

This class simply inherits all of the methods of TestMakeOutput, but changes the definition of xml_to_tester to create a CMakeTester instead.

setUp()[source]

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

test_append_flags()[source]

Test appending flags to a list.

test_append_flags_without_base()[source]

Test appending flags to a value set before Macros is included.

test_appends_not_overriden()[source]

Test that machine-specific base value changes don’t interfere with appends.

test_base_flags()[source]

Test that we get “base” compiler flags.

test_build_time_append_flags()[source]

Test build_time selection of compiler flags.

test_build_time_attribute()[source]

The macro writer writes conditionals for build-time choices.

test_build_time_base_flags()[source]

Test selection of base flags based on build-time attributes.

test_build_time_base_flags_same_parent()[source]

Test selection of base flags in the same parent element.

test_compiler_changeable_at_build_time()[source]

The macro writer writes information for multiple compilers.

test_config_reject_cyclical_references()[source]

Test that cyclical $VAR references are rejected.

test_config_reject_self_references()[source]

Test that $VAR self-references are rejected.

test_config_variable_insertion()[source]

Test that $VAR insert variables from config_compilers.

test_env_and_shell_command()[source]

Test that $ENV works inside $SHELL elements.

test_environment_variable_insertion()[source]

Test that ENV{..} inserts environment variables.

test_generic_item()[source]

The macro writer can write out a single generic item.

test_ignore_non_match()[source]

The macro writer ignores an entry with the wrong machine name.

test_mach_and_os_beats_mach()[source]

The macro writer chooses the most-specific match possible.

test_mach_beats_os()[source]

The macro writer chooses machine-specific over os-specific matches.

test_mach_other_compiler()[source]

The macro writer compiler-specific logic works as expected.

test_machine_specific_append_flags()[source]

Test appending flags that are either more or less machine-specific.

test_machine_specific_base_and_append_flags()[source]

Test that machine-specific base flags coexist with machine-specific append flags.

test_machine_specific_base_flags()[source]

Test selection among base compiler flag sets based on machine.

test_machine_specific_base_keeps_append_flags()[source]

Test that machine-specific base flags don’t override default append flags.

test_machine_specific_item()[source]

The macro writer can pick out a machine-specific item.

test_multilevel_specificity()[source]

Check that settings with multiple levels of machine-specificity can be resolved.

test_multiple_shell_commands()[source]

Test that more than one $SHELL element can be used.

test_os_specific_item()[source]

The macro writer can pick out an OS-specific item.

test_override_with_machine_and_new_attributes()[source]

Test that overrides with machine-specific settings with added attributes work correctly.

test_override_with_machine_and_same_attributes()[source]

Test that machine-specific conditional overrides with the same attribute work correctly.

test_reject_ambiguous()[source]

The macro writer dies if given an ambiguous set of matches.

test_reject_duplicate_defaults()[source]

The macro writer dies if given many defaults.

test_reject_duplicates()[source]

The macro writer dies if given many matches for a given configuration.

test_remove_dependency_issues()[source]

Check that overridden settings don’t cause inter-variable dependencies.

test_shell_command_insertion()[source]

Test that $SHELL insert shell command output.

test_variable_insertion_with_machine_specific_setting()[source]

Test that machine-specific $VAR dependencies are correct.

xml_to_tester(xml_string)[source]

Helper that directly converts an XML string to a MakefileTester.

CIME.tests.test_sys_create_newcase module

class CIME.tests.test_sys_create_newcase.TestCreateNewcase(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_a_createnewcase()[source]
test_aa_no_flush_on_instantiate()[source]
test_b_user_mods()[source]
test_c_create_clone_keepexe()[source]
test_d_create_clone_new_user()[source]
test_dd_create_clone_not_writable()[source]
test_e_xmlquery()[source]
test_f_createnewcase_with_user_compset()[source]
test_g_createnewcase_with_user_compset_and_env_mach_pes()[source]
test_h_primary_component()[source]
test_j_createnewcase_user_compset_vs_alias()[source]

Create a compset using the alias and another compset using the full compset name and make sure they are the same by comparing the namelist files in CaseDocs. Ignore the modelio files and clean the directory names out first.

test_k_append_config()[source]
test_ka_createnewcase_extra_machines_dir()[source]
test_m_createnewcase_alternate_drivers()[source]
test_n_createnewcase_bad_compset()[source]

CIME.tests.test_sys_full_system module

class CIME.tests.test_sys_full_system.TestFullSystem(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

test_full_system()[source]

CIME.tests.test_sys_grid_generation module

class CIME.tests.test_sys_grid_generation.TestGridGeneration(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_gen_domain()[source]

CIME.tests.test_sys_jenkins_generic_job module

class CIME.tests.test_sys_jenkins_generic_job.TestJenkinsGenericJob(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

assert_num_leftovers(suite)[source]
setUp()[source]

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

simple_test(expect_works, extra_args, build_name=None)[source]
tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_jenkins_generic_job()[source]
test_jenkins_generic_job_kill()[source]
test_jenkins_generic_job_realistic_dash()[source]
threaded_test(expect_works, extra_args, build_name=None)[source]

CIME.tests.test_sys_macro_basic module

class CIME.tests.test_sys_macro_basic.TestMacrosBasic(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

Basic infrastructure tests.

This class contains tests that do not actually depend on the output of the macro file conversion. This includes basic smoke testing and tests of error-handling in the routine.

setUp()[source]

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

test_script_is_callable()[source]

The test script can be called on valid output without dying.

test_script_rejects_bad_build_system()[source]

The macro writer rejects a bad build system string.

test_script_rejects_bad_xml()[source]

The macro writer rejects input that’s not valid XML.

CIME.tests.test_sys_make_macros module

class CIME.tests.test_sys_make_macros.TestMakeMacros(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

Makefile macros tests.

This class contains tests of the Makefile output of Build.

Aside from the usual setUp and test methods, this class has a utility method (xml_to_tester) that converts XML input directly to a MakefileTester object.

setUp()[source]

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

test_append_flags()[source]

Test appending flags to a list.

test_append_flags_without_base()[source]

Test appending flags to a value set before Macros is included.

test_appends_not_overriden()[source]

Test that machine-specific base value changes don’t interfere with appends.

test_base_flags()[source]

Test that we get “base” compiler flags.

test_build_time_append_flags()[source]

Test build_time selection of compiler flags.

test_build_time_attribute()[source]

The macro writer writes conditionals for build-time choices.

test_build_time_base_flags()[source]

Test selection of base flags based on build-time attributes.

test_build_time_base_flags_same_parent()[source]

Test selection of base flags in the same parent element.

test_compiler_changeable_at_build_time()[source]

The macro writer writes information for multiple compilers.

test_config_reject_cyclical_references()[source]

Test that cyclical $VAR references are rejected.

test_config_reject_self_references()[source]

Test that $VAR self-references are rejected.

test_config_variable_insertion()[source]

Test that $VAR insert variables from config_compilers.

test_env_and_shell_command()[source]

Test that $ENV works inside $SHELL elements.

test_environment_variable_insertion()[source]

Test that ENV{..} inserts environment variables.

test_generic_item()[source]

The macro writer can write out a single generic item.

test_ignore_non_match()[source]

The macro writer ignores an entry with the wrong machine name.

test_mach_and_os_beats_mach()[source]

The macro writer chooses the most-specific match possible.

test_mach_beats_os()[source]

The macro writer chooses machine-specific over os-specific matches.

test_mach_other_compiler()[source]

The macro writer compiler-specific logic works as expected.

test_machine_specific_append_flags()[source]

Test appending flags that are either more or less machine-specific.

test_machine_specific_base_and_append_flags()[source]

Test that machine-specific base flags coexist with machine-specific append flags.

test_machine_specific_base_flags()[source]

Test selection among base compiler flag sets based on machine.

test_machine_specific_base_keeps_append_flags()[source]

Test that machine-specific base flags don’t override default append flags.

test_machine_specific_item()[source]

The macro writer can pick out a machine-specific item.

test_multilevel_specificity()[source]

Check that settings with multiple levels of machine-specificity can be resolved.

test_multiple_shell_commands()[source]

Test that more than one $SHELL element can be used.

test_os_specific_item()[source]

The macro writer can pick out an OS-specific item.

test_override_with_machine_and_new_attributes()[source]

Test that overrides with machine-specific settings with added attributes work correctly.

test_override_with_machine_and_same_attributes()[source]

Test that machine-specific conditional overrides with the same attribute work correctly.

test_reject_ambiguous()[source]

The macro writer dies if given an ambiguous set of matches.

test_reject_duplicate_defaults()[source]

The macro writer dies if given many defaults.

test_reject_duplicates()[source]

The macro writer dies if given many matches for a given configuration.

test_remove_dependency_issues()[source]

Check that overridden settings don’t cause inter-variable dependencies.

test_shell_command_insertion()[source]

Test that $SHELL insert shell command output.

test_variable_insertion_with_machine_specific_setting()[source]

Test that machine-specific $VAR dependencies are correct.

xml_to_tester(xml_string)[source]

Helper that directly converts an XML string to a MakefileTester.

CIME.tests.test_sys_manage_and_query module

class CIME.tests.test_sys_manage_and_query.TestManageAndQuery(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

Tests various scripts to manage and query xml files

setUp()[source]

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

test_query_testlists_count_runs()[source]

Make sure that query_testlists runs successfully with the –count argument

test_query_testlists_define_testtypes_runs()[source]

Make sure that query_testlists runs successfully with the –define-testtypes argument

test_query_testlists_list_runs()[source]

Make sure that query_testlists runs successfully with the –list argument

test_query_testlists_runs()[source]

Make sure that query_testlists runs successfully

This simply makes sure that query_testlists doesn’t generate any errors when it runs. This helps ensure that changes in other utilities don’t break query_testlists.

CIME.tests.test_sys_query_config module

class CIME.tests.test_sys_query_config.TestQueryConfig(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

setUp()[source]

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

test_query_components()[source]
test_query_compsets()[source]
test_query_grids()[source]
test_query_machines()[source]

CIME.tests.test_sys_run_restart module

class CIME.tests.test_sys_run_restart.TestRunRestart(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

test_run_restart()[source]
test_run_restart_too_many_fails()[source]

CIME.tests.test_sys_save_timings module

class CIME.tests.test_sys_save_timings.TestSaveTimings(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

simple_test(manual_timing=False)[source]
test_save_timings()[source]
test_save_timings_manual()[source]
test_success_recording()[source]

CIME.tests.test_sys_single_submit module

class CIME.tests.test_sys_single_submit.TestSingleSubmit(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

test_single_submit()[source]

CIME.tests.test_sys_test_scheduler module

class CIME.tests.test_sys_test_scheduler.TestTestScheduler(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

test_a_phases()[source]
test_b_full()[source]
test_c_use_existing()[source]
test_chksum(strftime)[source]
test_d_retry()[source]

CIME.tests.test_sys_unittest module

class CIME.tests.test_sys_unittest.TestUnitTest(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_a_unit_test()[source]
test_b_cime_f90_unit_tests()[source]

CIME.tests.test_sys_user_concurrent_mods module

class CIME.tests.test_sys_user_concurrent_mods.TestUserConcurrentMods(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

test_user_concurrent_mods()[source]

CIME.tests.test_sys_wait_for_tests module

class CIME.tests.test_sys_wait_for_tests.TestWaitForTests(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

live_test_impl(testdir, expected_results, last_phase, last_status)[source]
setUp()[source]

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

simple_test(testdir, expected_results, extra_args='', build_name=None)[source]
tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_wait_for_test_all_pass()[source]
test_wait_for_test_cdash_kill()[source]
test_wait_for_test_cdash_pass()[source]
test_wait_for_test_no_wait()[source]
test_wait_for_test_test_status_integration_pass()[source]
test_wait_for_test_test_status_integration_submit_fail()[source]
test_wait_for_test_timeout()[source]
test_wait_for_test_wait_for_missing_run_phase()[source]
test_wait_for_test_wait_for_pend()[source]
test_wait_for_test_wait_kill()[source]
test_wait_for_test_with_fail()[source]
threaded_test(testdir, expected_results, extra_args='', build_name=None)[source]

CIME.tests.test_unit_case module

class CIME.tests.test_unit_case.TestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

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

test_copy(getuser, getfqdn, configure, create_caseroot, apply_user_mods, set_lookup_value, lock_file, strftime, read_xml)[source]
test_create(get_user, getfqdn, configure, create_caseroot, apply_user_mods, set_lookup_value, lock_file, strftime, read_xml)[source]
test_new_hash(getuser, getfqdn, strftime, read_xml)[source]
class CIME.tests.test_unit_case.TestCaseSubmit(methodName='runTest')[source]

Bases: unittest.case.TestCase

test__submit(lock_file, unlock_file, basename)[source]
test_check_case()[source]
test_submit(read_xml, get_value, init, _submit)[source]
class CIME.tests.test_unit_case.TestCase_RecordCmd(methodName='runTest')[source]

Bases: unittest.case.TestCase

assert_calls_match(calls, expected)[source]
setUp()[source]

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

test_cmd_arg(get_value, flush, init)[source]
test_error(strftime, get_value, flush, init)[source]
test_init(strftime, get_value, flush, init)[source]
test_sub_relative(strftime, get_value, flush, init)[source]
CIME.tests.test_unit_case.make_valid_case(path)[source]

Make the given path look like a valid case to avoid errors

CIME.tests.test_unit_case_fake module

This module contains unit tests of CaseFake

class CIME.tests.test_unit_case_fake.TestCaseFake(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

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

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_create_clone()[source]

CIME.tests.test_unit_case_setup module

class CIME.tests.test_unit_case_setup.TestCaseSetup(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_create_macros(_create_macros_cmake)[source]
test_create_macros_cmake(copy_depends_files)[source]
test_create_macros_copy_extra()[source]
test_create_macros_copy_user()[source]
CIME.tests.test_unit_case_setup.chdir(path)[source]
CIME.tests.test_unit_case_setup.create_machines_dir()[source]

Creates temp machines directory with fake content

CIME.tests.test_unit_compare_test_results module

This module contains unit tests for compare_test_results

class CIME.tests.test_unit_compare_test_results.TestCaseFake(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

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

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_baseline()[source]
test_failed_early()[source]
test_hist_only()[source]
test_namelists_only()[source]

CIME.tests.test_unit_compare_two module

This module contains unit tests of the core logic in SystemTestsCompareTwo.

class CIME.tests.test_unit_compare_two.Call(method, arguments)

Bases: tuple

arguments

Alias for field number 1

method

Alias for field number 0

class CIME.tests.test_unit_compare_two.SystemTestsCompareTwoFake(case1, run_one_suffix='base', run_two_suffix='test', separate_builds=False, multisubmit=False, case2setup_raises_exception=False, run_one_should_pass=True, run_two_should_pass=True, compare_should_pass=True)[source]

Bases: CIME.SystemTests.system_tests_compare_two.SystemTestsCompareTwo

run_indv(suffix='base', st_archive=False, submit_resubmits=None)[source]

This fake implementation appends to the log and raises an exception if it’s supposed to

Note that the Call object appended to the log has the current CASE name in addition to the method arguments. (This is mainly to ensure that the proper suffix is used for the proper case, but this extra check can be removed if it’s a maintenance problem.)

class CIME.tests.test_unit_compare_two.TestSystemTestsCompareTwo(methodName='runTest')[source]

Bases: unittest.case.TestCase

get_caseroots(casename='mytest')[source]

Returns a tuple (case1root, case2root)

get_compare_phase_name(mytest)[source]

Returns a string giving the compare phase name for this test

setUp()[source]

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

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_compare_fails()[source]
test_compare_passes()[source]
test_internal_calls_multisubmit_failed_state()[source]
test_run1_fails()[source]
test_run2_fails()[source]
test_run_phase_internal_calls()[source]
test_run_phase_internal_calls_multisubmit_phase1()[source]
test_run_phase_internal_calls_multisubmit_phase2()[source]
test_run_phase_passes()[source]
test_setup()[source]
test_setup_case2_exists()[source]
test_setup_error()[source]
test_setup_separate_builds_sharedlibroot()[source]

CIME.tests.test_unit_cs_status module

class CIME.tests.test_unit_cs_status.TestCsStatus(methodName='runTest')[source]

Bases: CIME.tests.custom_assertions_test_status.CustomAssertionsTestStatus

create_test_dir(test_dir)[source]

Creates the given test directory under testroot.

Returns the full path to the created test directory.

static create_test_status_core_passes(test_dir_path, test_name)[source]

Creates a TestStatus file in the given path, with PASS status for all core phases

setUp()[source]

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

set_last_core_phase_to_fail(test_dir_path, test_name)[source]

Sets the last core phase to FAIL

Returns the name of this phase

static set_phase_to_status(test_dir_path, test_name, phase, status)[source]

Sets the given phase to the given status for this test

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_count_fails()[source]

Test the count of fails with three tests

For first phase of interest: First test FAILs, second PASSes, third FAILs; count should be 2, and this phase should not appear individually for each test.

For second phase of interest: First test PASSes, second PASSes, third FAILs; count should be 1, and this phase should not appear individually for each test.

test_expected_fails()[source]

With the expected_fails_file flag, expected failures should be flagged as such

test_fails_only()[source]

With fails_only flag, only fails and pends should appear in the output

test_single_test()[source]

cs_status for a single test should include some minimal expected output

test_two_tests()[source]

cs_status for two tests (one with a FAIL) should include some minimal expected output

CIME.tests.test_unit_custom_assertions_test_status module

This module contains unit tests of CustomAssertionsTestStatus

class CIME.tests.test_unit_custom_assertions_test_status.TestCustomAssertions(methodName='runTest')[source]

Bases: CIME.tests.custom_assertions_test_status.CustomAssertionsTestStatus

static output_line(status, test_name, phase, extra='')[source]
test_assertCorePhases_missingPhase_fails()[source]

assert_core_phases fails if there is a missing phase

test_assertCorePhases_passes()[source]

assert_core_phases passes when it should

test_assertCorePhases_wrongName_fails()[source]

assert_core_phases fails if the test name is wrong

test_assertCorePhases_wrongStatus_fails()[source]

assert_core_phases fails if a phase has the wrong status

test_assertPhaseAbsent_fails()[source]

assert_phase_absent should fail when the phase is present for the given test_name

test_assertPhaseAbsent_passes()[source]

assert_phase_absent should pass when the phase is absent for the given test_name

test_assertStatusOfPhase_withExtra_passes()[source]

Make sure assert_status_of_phase passes when there is some extra text at the end of the line

test_assertStatusOfPhase_xfailExpected_fails()[source]

assert_status_of_phase should fail when xfail=’expected’ but the line does NOT contain the EXPECTED comment

test_assertStatusOfPhase_xfailExpected_passes()[source]

assert_status_of_phase should pass when xfail=’expected’ and the line contains the EXPECTED comment

test_assertStatusOfPhase_xfailNo_fails()[source]

assert_status_of_phase should fail when xfail=’no’ but the line contains the EXPECTED comment

test_assertStatusOfPhase_xfailNo_passes()[source]

assert_status_of_phase should pass when xfail=’no’ and there is no EXPECTED/UNEXPECTED on the line

test_assertStatusOfPhase_xfailUnexpected_fails()[source]

assert_status_of_phase should fail when xfail=’unexpected’ but the line does NOT contain the UNEXPECTED comment

test_assertStatusOfPhase_xfailUnexpected_passes()[source]

assert_status_of_phase should pass when xfail=’unexpected’ and the line contains the UNEXPECTED comment

CIME.tests.test_unit_doctest module

class CIME.tests.test_unit_doctest.TestDocs(methodName='runTest')[source]

Bases: CIME.tests.base.BaseTestCase

test_lib_docs()[source]

CIME.tests.test_unit_expected_fails_file module

class CIME.tests.test_unit_expected_fails_file.TestExpectedFailsFile(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

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

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_basic()[source]

Basic test of the parsing of an expected fails file

test_invalid_file()[source]

Given an invalid file, an exception should be raised in schema validation

test_same_test_appears_twice()[source]

If the same test appears twice, its information should be appended.

This is not the typical, expected layout of the file, but it should be handled correctly in case the file is written this way.

CIME.tests.test_unit_grids module

This module tests some functionality of CIME.XML.grids

class CIME.tests.test_unit_grids.TestComponentGrids(methodName='runTest')[source]

Bases: unittest.case.TestCase

Tests the _ComponentGrids helper class defined in CIME.XML.grids

test_check_num_elements_right_ndomains()[source]

With the right number of domains for a component, check_num_elements should pass

test_check_num_elements_right_nmaps()[source]

With the right number of maps between two components, check_num_elements should pass

test_check_num_elements_wrong_ndomains()[source]

With the wrong number of domains for a component, check_num_elements should fail

test_check_num_elements_wrong_nmaps()[source]

With the wrong number of maps between two components, check_num_elements should fail

class CIME.tests.test_unit_grids.TestGrids(methodName='runTest')[source]

Bases: unittest.case.TestCase

Tests some functionality of CIME.XML.grids

Note that much of the functionality of CIME.XML.grids is NOT covered here

assert_grid_info_f09_g17(grid_info)[source]

Asserts that expected grid info is present and correct when using _MODEL_GRID_F09_G17

assert_grid_info_f09_g17_3glc(grid_info)[source]

Asserts that all domain info is present & correct for _MODEL_GRID_F09_G17_3GLC

setUp()[source]

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

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_get_grid_info_3glc()[source]

Test of get_grid_info with 3 glc grids

test_get_grid_info_basic()[source]

Basic test of get_grid_info

test_get_grid_info_extra_gridmaps()[source]

Test of get_grid_info with some extra gridmaps

test_get_grid_info_extra_required_gridmaps()[source]

Test of get_grid_info with some extra required gridmaps

class CIME.tests.test_unit_grids.TestGridsFunctions(methodName='runTest')[source]

Bases: unittest.case.TestCase

Tests helper functions defined in CIME.XML.grids

These tests are in a separate class to avoid the unnecessary setUp and tearDown function of the main test class.

test_add_grid_info_existing()[source]

Test of _add_grid_info when the given key already exists

test_add_grid_info_existing_with_value_for_multiple()[source]

Test of _add_grid_info when the given key already exists and value_for_multiple is provided

test_add_grid_info_initial()[source]

Test of _add_grid_info for the initial add of a given key

test_strip_grid_from_name_badname()[source]

_strip_grid_from_name should raise an exception for a name not ending with _grid

test_strip_grid_from_name_basic()[source]

Basic test of _strip_grid_from_name

CIME.tests.test_unit_nmlgen module

class CIME.tests.test_unit_nmlgen.TestNamelistGenerator(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_init_defaults()[source]

CIME.tests.test_unit_provenance module

class CIME.tests.test_unit_provenance.TestProvenance(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_find_git_root()[source]
test_find_git_root_error()[source]
test_find_git_root_worktree()[source]
test_find_git_root_worktree_malformed()[source]
test_parse_dot_git_path()[source]
test_parse_dot_git_path_error()[source]
test_record_git_provenance(run_cmd, safe_copy)[source]
test_run_git_cmd_recursively(run_cmd)[source]
test_run_git_cmd_recursively_error(run_cmd)[source]

CIME.tests.test_unit_test_status module

class CIME.tests.test_unit_test_status.TestTestStatus(methodName='runTest')[source]

Bases: CIME.tests.custom_assertions_test_status.CustomAssertionsTestStatus

setUp()[source]

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

test_psdump_corePhasesPass()[source]
test_psdump_oneCorePhaseFails()[source]
test_psdump_oneCorePhaseFailsAbsentFromXFails()[source]

One phase fails. There is an expected fails list, but that phase is not in it.

test_psdump_oneCorePhaseFailsInXFails()[source]

One phase fails. That phase is in the expected fails list.

test_psdump_oneCorePhasePassesInXFails()[source]

One phase passes despite being in the expected fails list.

test_psdump_skipPasses()[source]

With the skip_passes argument, only non-passes should appear

test_psdump_unexpectedPass_shouldBePresent()[source]

Even with the skip_passes argument, an unexpected PASS should be present

CIME.tests.test_unit_user_mod_support module

class CIME.tests.test_unit_user_mod_support.TestUserModSupport(methodName='runTest')[source]

Bases: unittest.case.TestCase

assertResults(expected_user_nl_cpl, expected_shell_commands_result, expected_sourcemod, msg='')[source]

Asserts that the contents of the files in self._caseroot match expectations

If msg is provided, it is printed for some failing assertions

createUserMod(name, include_dirs=None)[source]

Create a user_mods directory with the given name.

This directory is created within self._user_mods_parent_dir

For name=’foo’, it will contain:

  • A user_nl_cpl file with contents: foo

  • A shell_commands file with contents: echo foo >> /PATH/TO/CASEROOT/shell_commands_result

  • A file in _SOURCEMODS named myfile.F90 with contents: foo

If include_dirs is given, it should be a list of strings, giving names of other user_mods directories to include. e.g., if include_dirs is [‘foo1’, ‘foo2’], then this will create a file ‘include_user_mods’ that contains paths to the ‘foo1’ and ‘foo2’ user_mods directories, one per line.

setUp()[source]

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

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_basic()[source]
test_duplicate_includes()[source]

Test multiple includes, where both include the same base mod.

The base mod should only be included once.

test_include()[source]

If there is an included mod, the main one should appear after the included one so that it takes precedence.

test_keepexe()[source]
test_two_applications()[source]

If apply_user_mods is called twice, the second should appear after the first so that it takes precedence.

CIME.tests.test_unit_user_nl_utils module

class CIME.tests.test_unit_user_nl_utils.TestUserNLCopier(methodName='runTest')[source]

Bases: unittest.case.TestCase

assertFileContentsEqual(expected, filepath, msg=None)[source]

Asserts that the contents of the file given by ‘filepath’ are equal to the string given by ‘expected’. ‘msg’ gives an optional message to be printed if the assertion fails.

setUp()[source]

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

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_append()[source]
test_append_multiple_files()[source]
test_append_without_files_raises_exception()[source]
write_user_nl_file(component, contents, suffix='')[source]

Write contents to a user_nl file in the case directory. Returns the basename (i.e., not the full path) of the file that is created.

For a component foo, with the default suffix of ‘’, the file name will be user_nl_foo

If the suffix is ‘_0001’, the file name will be user_nl_foo_0001

CIME.tests.test_unit_utils module

class CIME.tests.test_unit_utils.MockTime[source]

Bases: object

class CIME.tests.test_unit_utils.TestFileContainsPythonFunction(methodName='runTest')[source]

Bases: unittest.case.TestCase

Tests of file_contains_python_function

create_test_file(contents)[source]

Creates a test file with the given contents, and returns the path to that file

setUp()[source]

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

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_contains_correct_def_and_others()[source]

Test file_contains_python_function with a correct def mixed with other defs

test_does_not_contain_correct_def()[source]

Test file_contains_python_function without the correct def

class CIME.tests.test_unit_utils.TestIndentStr(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test the indent_string function.

test_indent_string_multiline()[source]

Test the indent_string function with a multi-line string

test_indent_string_singleline()[source]

Test the indent_string function with a single-line string

class CIME.tests.test_unit_utils.TestLineDefinesPythonFunction(methodName='runTest')[source]

Bases: unittest.case.TestCase

Tests of _line_defines_python_function

test_def_barfoo()[source]

Test of a def of a different function

test_def_foo()[source]

Test of a def of the function of interest

test_def_foo_indented()[source]

Test of a def of the function of interest, but indented

test_def_foo_no_parens()[source]

Test of a def of the function of interest, but without parentheses

test_def_foo_space()[source]

Test of a def of the function of interest, with an extra space before the parentheses

test_def_foobar()[source]

Test of a def of a different function

test_import_barfoo()[source]

Test of an import of a different function

test_import_foo()[source]

Test of an import of the function of interest

test_import_foo_indented()[source]

Test of an import of the function of interest, but indented

test_import_foo_space()[source]

Test of an import of the function of interest, with trailing spaces

test_import_foo_then_others()[source]

Test of an import of the function of interest, along with others

test_import_foobar()[source]

Test of an import of a different function

test_import_others_then_foo()[source]

Test of an import of the function of interest, after others

class CIME.tests.test_unit_utils.TestUtils(methodName='runTest')[source]

Bases: unittest.case.TestCase

assertMatchAllLines(tempdir, test_lines)[source]
setUp()[source]

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

test_import_from_file()[source]
test_run_and_log_case_status()[source]
test_run_and_log_case_status_case_submit_error_on_batch()[source]
test_run_and_log_case_status_case_submit_no_batch()[source]
test_run_and_log_case_status_case_submit_on_batch()[source]
test_run_and_log_case_status_custom_msg()[source]
test_run_and_log_case_status_custom_msg_error_on_batch()[source]
test_run_and_log_case_status_error()[source]
CIME.tests.test_unit_utils.match_all_lines(data, lines)[source]

CIME.tests.test_unit_xml_env_batch module

class CIME.tests.test_unit_xml_env_batch.TestXMLEnvBatch(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_get_queue_specs(get)[source]
test_set_job_defaults(get_default_queue, select_best_queue, get_queue_specs, text)[source]
test_set_job_defaults_honor_walltimemax(get_default_queue, select_best_queue, get_queue_specs, text)[source]
test_set_job_defaults_honor_walltimemin(get_default_queue, select_best_queue, get_queue_specs, text)[source]
test_set_job_defaults_user_walltime(get_default_queue, select_best_queue, get_queue_specs, text)[source]
test_set_job_defaults_walltimedef(get_default_queue, select_best_queue, get_queue_specs, text)[source]
test_set_job_defaults_walltimemax_none(get_default_queue, select_best_queue, get_queue_specs, text)[source]
test_set_job_defaults_walltimemin_none(get_default_queue, select_best_queue, get_queue_specs, text)[source]

CIME.tests.test_unit_xml_namelist_definition module

class CIME.tests.test_unit_xml_namelist_definition.TestXMLNamelistDefinition(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_set_nodes()[source]

CIME.tests.utils module

class CIME.tests.utils.CMakeTester(parent, cmake_string)[source]

Bases: object

Helper class for checking CMake output.

Public methods: __init__ query_var assert_variable_equals assert_variable_matches

assert_variable_equals(var_name, value, env=None, var=None)[source]

Assert that a variable in the CMakeLists has a given value.

Arguments: var_name - Name of variable to check. value - The string that the variable value should be equal to. env - Optional. Dict of environment variables to set when calling cmake. var - Optional. Dict of CMake variables to set when calling cmake.

assert_variable_matches(var_name, regex, env=None, var=None)[source]

Assert that a variable in the CMkeLists matches a regex.

Arguments: var_name - Name of variable to check. regex - The regex to match. env - Optional. Dict of environment variables to set when calling cmake. var - Optional. Dict of CMake variables to set when calling cmake.

query_var(var_name, env, var)[source]

Request the value of a variable in Macros.cmake, as a string.

Arguments: var_name - Name of the variable to query. env - A dict containing extra environment variables to set when calling

cmake.

var - A dict containing extra CMake variables to set when calling cmake.

class CIME.tests.utils.MakefileTester(parent, make_string)[source]

Bases: object

Helper class for checking Makefile output.

Public methods: __init__ query_var assert_variable_equals assert_variable_matches

assert_variable_equals(var_name, value, env=None, var=None)[source]

Assert that a variable in the Makefile has a given value.

Arguments: var_name - Name of variable to check. value - The string that the variable value should be equal to. env - Optional. Dict of environment variables to set when calling make. var - Optional. Dict of make variables to set when calling make.

assert_variable_matches(var_name, regex, env=None, var=None)[source]

Assert that a variable in the Makefile matches a regex.

Arguments: var_name - Name of variable to check. regex - The regex to match. env - Optional. Dict of environment variables to set when calling make. var - Optional. Dict of make variables to set when calling make.

query_var(var_name, env, var)[source]

Request the value of a variable in the Makefile, as a string.

Arguments: var_name - Name of the variable to query. env - A dict containing extra environment variables to set when calling

make.

var - A dict containing extra make variables to set when calling make.
(The distinction between env and var actually matters only for

CMake, though.)

class CIME.tests.utils.MockMachines(name, os_)[source]

Bases: object

A mock version of the Machines object to simplify testing.

get_default_MPIlib(attributes=None)[source]
get_default_compiler()[source]
get_machine_name()[source]

Return the name we were given.

get_value(var_name)[source]

Allow the operating system to be queried.

is_valid_MPIlib(_)[source]

Assume all MPILIB settings are valid.

is_valid_compiler(_)[source]

Assume all compilers are valid.

class CIME.tests.utils.Mocker(ret=None, cmd=None, return_value=None, side_effect=None)[source]

Bases: object

assert_called()[source]
assert_called_with(i=None, args=None, kwargs=None)[source]
property calls
property method_calls
patch(module, method=None, ret=None, is_property=False, update_value_only=False)[source]
property ret
revert_mocks()[source]
class CIME.tests.utils.TemporaryDirectory[source]

Bases: object

CIME.tests.utils.get_macros(macro_maker, build_xml, build_system)[source]

Generate build system (“Macros” file) output from config_compilers XML.

Arguments: macro_maker - The underlying Build object. build_xml - A string containing the XML to operate on. build_system - Either “Makefile” or “CMake”, depending on desired output.

The return value is a string containing the build system output.

CIME.tests.utils.make_fake_teststatus(path, testname, status, phase)[source]
CIME.tests.utils.parse_test_status(line)[source]

Module contents