CIME.tests package¶
Subpackages¶
Submodules¶
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
-
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
-
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
-
set_exeroot
()[source]¶ Assumes CASEROOT is already set; sets an appropriate EXEROOT (nested inside CASEROOT)
-
CIME.tests.test_case_fake module¶
This module contains unit tests of CaseFake
CIME.tests.test_user_mod_support module¶
-
class
CIME.tests.test_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.
-
test_duplicate_includes
()[source]¶ Test multiple includes, where both include the same base mod.
The base mod should only be included once.
-