示例#1
0
 def test_parse_mdtf_args_frepp_overwrite_both(self):
     # overwrite defaults and command-line
     d = gfdl.parse_frepp_stub(self.frepp_stub)
     args = {'frepp': True, 'OUTPUT_DIR': '/X', 'E': 'Y'}
     mdtf = MDTFFramework.__new__(MDTFFramework)
     config = self.config_test.copy()
     config = MDTFFramework.parse_mdtf_args([d, args], config)
     self.assertEqual(config['paths']['OUTPUT_DIR'], '/foo/bar')
     self.assertEqual(config['settings']['make_variab_tar'], True)
     self.assertEqual(config['settings']['E'], 'Y')
示例#2
0
 def test_parse_mdtf_args_frepp_overwrite(self):
     # overwrite defaults
     frepp_stub = self.frepp_stub  # make a copy to be safe
     d = gfdl.parse_frepp_stub(frepp_stub)
     args = {'frepp': True}
     mdtf = MDTFFramework.__new__(MDTFFramework)
     config = self.config_test.copy()
     config = MDTFFramework.parse_mdtf_args([d, args], config)
     self.assertEqual(config['paths']['OUTPUT_DIR'], '/foo/bar')
     self.assertEqual(config['settings']['make_variab_tar'], True)
     self.assertEqual(config['settings']['E'], 'F')
示例#3
0
 def test_parse_mdtf_args_frepp_caselist(self):
     # overwrite defaults and command-line
     d = gfdl.parse_frepp_stub(self.frepp_stub)
     args = {'frepp': True}
     mdtf = MDTFFramework.__new__(MDTFFramework)
     config = self.config_test.copy()
     config = MDTFFramework.parse_mdtf_args([d, args], config)
     self.assertEqual(len(config['case_list']), 1)
     self.assertEqual(config['case_list'][0]['CASENAME'], 'baz.r1i1p1f1')
     self.assertEqual(config['case_list'][0]['model'], 'CMIP_GFDL')
     self.assertEqual(config['case_list'][0]['variable_convention'],
                      'CMIP_GFDL')
     self.assertEqual(config['case_list'][0]['FIRSTYR'], 1977)
     self.assertEqual(config['case_list'][0]['LASTYR'], 1981)
示例#4
0
 def test_set_mdtf_env_vars_config_settings(self, mock_check_required_dirs):
     # NB env vars now only written to OS by pod's setUp (not here)
     # set settings from config file
     mdtf = MDTFFramework.__new__(MDTFFramework)
     mdtf.config = self.config_test.copy()
     mdtf.set_mdtf_env_vars()
     self.assertEqual(mdtf.config['envvars']['E'], 'F')
示例#5
0
 def test_parse_mdtf_args_config_cmdline(self):
     # override config file with command line arguments
     args = {'C': '/X', 'E': 'Y'}
     config = self.config_test.copy()
     config = MDTFFramework.parse_mdtf_args(args, config)
     self.assertEqual(config['paths']['C'], '/X')
     self.assertEqual(config['settings']['E'], 'Y')
示例#6
0
 def test_parse_mdtf_args_config(self):
     # set paths from config file
     args = {}
     config = self.config_test.copy()
     config = MDTFFramework.parse_mdtf_args(args, config)
     self.assertEqual(config['paths']['C'], '/D')
     self.assertEqual(config['settings']['E'], 'F')
示例#7
0
 def test_sset_mdtf_env_vars_config_rgb(self, mock_check_required_dirs):
     # NB env vars now only written to OS by pod's setUp (not here)
     # set path to /RGB from os.environ
     mdtf = MDTFFramework.__new__(MDTFFramework)
     mdtf.config = self.config_test.copy()
     mdtf.set_mdtf_env_vars()
     self.assertEqual(mdtf.config['envvars']['RGB'],
                      'TEST_CODE_ROOT/src/rgb')