Exemplo n.º 1
0
 def tearDown(self):
     # call _reset method clearing ModuleManager for unit testing,
     # otherwise the second, third, .. tests will use the instance created
     # in the first test instead of being properly initialized
     temp = gfdl_util.ModuleManager()
     temp.revert_state()
     temp._reset()
Exemplo n.º 2
0
 def test_module_unload(self):
     modMgr = gfdl_util.ModuleManager()
     modMgr.load(self.test_mod_name)
     mod_list = modMgr._list()
     self.assertIn(self.test_mod_name, mod_list)
     modMgr.unload(self.test_mod_name)
     mod_list = modMgr._list()
     self.assertNotIn(self.test_mod_name, mod_list)
Exemplo n.º 3
0
 def test_module_list(self):
     cmd = '{}/bin/modulecmd'.format(os.environ['MODULESHOME'])
     # module list writes to stderr, because all module user output does
     list1 = subprocess.check_output([cmd, 'python', 'list', '-t'],
                                     stderr=subprocess.STDOUT).splitlines()
     del list1[0]
     list1 = set([s.replace('(default)', '') for s in list1])
     modMgr = gfdl_util.ModuleManager()
     list2 = set(modMgr._list())
     self.assertEqual(list1, list2)
Exemplo n.º 4
0
 def tear_down(self):
     super(GfdlvirtualenvEnvironmentManager, self).tear_down()
     modMgr = gfdl_util.ModuleManager()
     modMgr.revert_state()
Exemplo n.º 5
0
 def deactivate_env_commands(self, env_name):
     modMgr = gfdl_util.ModuleManager()
     mod_list = modMgr.unload_commands(self._module_lookup[env_name])
     return super(GfdlvirtualenvEnvironmentManager, \
         self).deactivate_env_commands(env_name) + mod_list
Exemplo n.º 6
0
 def activate_env_commands(self, env_name):
     modMgr = gfdl_util.ModuleManager()
     mod_list = modMgr.load_commands(self._module_lookup[env_name])
     return ['source $MODULESHOME/init/bash'] \
         + mod_list \
         + super(GfdlvirtualenvEnvironmentManager, self).activate_env_commands(env_name)
Exemplo n.º 7
0
 def create_environment(self, env_name):
     modMgr = gfdl_util.ModuleManager()
     modMgr.load(self._module_lookup[env_name])
     super(GfdlvirtualenvEnvironmentManager, \
         self).create_environment(env_name)
Exemplo n.º 8
0
 def __init__(self, log=_log):
     _ = gfdl_util.ModuleManager()
     super(GfdlvirtualenvEnvironmentManager, self).__init__(log=log)
Exemplo n.º 9
0
 def setup_fetch(self):
     modMgr = gfdl_util.ModuleManager()
     modMgr.load('gcp')
Exemplo n.º 10
0
 def setUp(self):
     _ = gfdl_util.ModuleManager()