コード例 #1
0
 def setUp(self):
     temp = util.PathManager(unittest_flag = True)
     self.config_test = {
         'case_list':[{'A':'B'}],
         'paths':{'C':'/D'},
         'settings':{'E':'F', 'verbose':0}
     }
コード例 #2
0
 def tearDown(self):
     # call _reset method deleting clearing Translator for unit testing,
     # otherwise the second, third, .. tests will use the instance created
     # in the first test instead of being properly initialized
     temp = util.VariableTranslator(unittest=True)
     temp._reset()
     temp = util.PathManager(unittest=True)
     temp._reset()
コード例 #3
0
 def test_pathmgr_pod(self, mock_exists, mock_read_yaml):
     paths = util.PathManager(unittest_flag = True)
     pod = Diagnostic('A')
     pod.MODEL_WK_DIR = 'B'
     d = paths.podPaths(pod)
     self.assertEqual(d['POD_CODE_DIR'], 'TEST_CODE_ROOT/diagnostics/A')
     self.assertEqual(d['POD_OBS_DATA'], 'TEST_OBS_DATA_ROOT/A')
     self.assertEqual(d['POD_WK_DIR'], 'B/A')
コード例 #4
0
 def test_pathmgr_global_asserterror(self):
     d = {
         'OBS_DATA_ROOT':'B', 'MODEL_DATA_ROOT':'C',
         'WORKING_DIR':'D', 'OUTPUT_DIR':'E'
     }
     self.assertRaises(AssertionError, util.PathManager, d)
     # initialize successfully so that tearDown doesn't break
     paths = util.PathManager(unittest_flag = True) 
コード例 #5
0
 def test_pathmgr_global(self):
     d = {
         'CODE_ROOT':'A', 'OBS_DATA_ROOT':'B', 'MODEL_DATA_ROOT':'C',
         'WORKING_DIR':'D', 'OUTPUT_DIR':'E'
     }
     paths = util.PathManager(d)
     self.assertEqual(paths.CODE_ROOT, 'A')
     self.assertEqual(paths.OUTPUT_DIR, 'E')
コード例 #6
0
 def setUp(self, mock_read_json):
     # set up translation dictionary without calls to filesystem
     _ = util.VariableTranslator(unittest=True)
     _ = util.PathManager(unittest=True)
コード例 #7
0
 def setUp(self):
     # set up paths without calls to filesystem
     temp = util.PathManager(unittest_flag = True)
コード例 #8
0
 def setUp(self, mock_read_yaml):
     # set up translation dictionary without calls to filesystem
     temp = util.VariableTranslator(unittest_flag = True)
     temp = util.PathManager(unittest_flag = True)
コード例 #9
0
 def test_pathmgr_pod_nomodel(self, mock_exists, mock_read_yaml):
     paths = util.PathManager(unittest_flag = True)
     pod = Diagnostic('A')
     d = paths.podPaths(pod)
     self.assertEqual(d['POD_CODE_DIR'], 'TEST_CODE_ROOT/diagnostics/A')
     self.assertNotIn('POD_WK_DIR', d)
コード例 #10
0
 def test_pathmgr_model(self):
     paths = util.PathManager(unittest_flag = True)
     case = DataManager(self.default_case)
     d = paths.modelPaths(case)
     self.assertEqual(d['MODEL_DATA_DIR'], 'TEST_MODEL_DATA_ROOT/A')
     self.assertEqual(d['MODEL_WK_DIR'], 'TEST_WORKING_DIR/MDTF_A_1900_2100')
コード例 #11
0
 def test_pathmgr_global_testmode(self):
     paths = util.PathManager(unittest_flag = True)
     self.assertEqual(paths.CODE_ROOT, 'TEST_CODE_ROOT')
     self.assertEqual(paths.OUTPUT_DIR, 'TEST_OUTPUT_DIR')