def test_04_ModuleHandling(self): self.do_imports() from DataQualityConfigurations import getmodule # OK for modules that should explicitly be around? for mod in self.modlist: self.assertTrue(getmodule(mod.__name__.replace('DataQualityConfigurations.', ''))) # OK for some modules that do not exist? for mname in ('data15_hi', 'data15_hip', 'data15_900GeV', 'data15_2p76TeV', 'data15_5TeV', 'data15_7TeV', 'data15_8TeV', 'data15_13TeV', 'data15_1beam', 'data15_cos', 'data15_calib', 'data15_calocomm', 'data15_larcomm', 'data15_tilecomm', 'data15_muoncomm', 'data15_idcomm', 'data15_comm', 'data15', ): self.assertTrue(getmodule(mname)) # Fails otherwise? self.assertRaises(ValueError, getmodule, 'NonExistentPtag')
def importConfiguration(modname): from DataQualityConfigurations import getmodule print 'getting configuration', modname return getmodule(modname)