CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TestProcess.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 class TestProcess(cms.Process):
4  def __init__(self,name="TEST",*modifiers):
5  super(TestProcess,self).__init__(name,*modifiers)
6  self.__dict__["_TestProcess__moduleToTest"] = None
7  def moduleToTest(self,mod,task=cms.Task()):
8  self.__dict__["_TestProcess__moduleToTest"] = mod
9  if isinstance(mod,cms.EDFilter):
10  self._test_path = cms.Path(mod,task)
11  else:
12  self._test_endpath = cms.EndPath(mod,task)
13  def fillProcessDesc(self, processPSet):
14  if self.__dict__["_TestProcess__moduleToTest"] is None:
15  raise LogicError("moduleToTest was not called")
16  for p in self.paths.iterkeys():
17  if p != "_test_path":
18  delattr(self,p)
19  for p in self.endpaths.iterkeys():
20  if p != "_test_endpath":
21  delattr(self,p)
22  if not hasattr(self,"options"):
23  self.options = cms.untracked.PSet()
24  cms.Process.fillProcessDesc(self,processPSet)
25  processPSet.addString(True, "@moduleToTest",self.__dict__["_TestProcess__moduleToTest"].label_())