示例#1
0
 def test_pathmgr_model(self, mock_register):
     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')
示例#2
0
 def test_pathmgr_pod(self, mock_exists, mock_read_json):
     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')
示例#3
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_flag=True)
     temp._reset()
     temp = util.PathManager()
     temp._reset()
示例#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
        _ = 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):
     _ = util.PathManager(unittest=True)
     self.config_test = {
         'case_list': [{
             'A': 'B'
         }],
         'paths': {
             'C': '/D'
         },
         'settings': {
             'E': 'F',
             'verbose': 0
         }
     }
示例#7
0
 def test_pathmgr_pod_nomodel(self, mock_exists, mock_read_json):
     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)
示例#8
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')
示例#9
0
 def setUp(self, mock_read_json):
     # set up translation dictionary without calls to filesystem
     _ = util.VariableTranslator(unittest_flag=True)
     _ = util.PathManager(unittest_flag=True)