CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
Utilities.TestModuleCommand Class Reference
Inheritance diagram for Utilities.TestModuleCommand:

Public Member Functions

def setup
 
def testConfig
 
def testNoSchedule
 
def testWithSchedule
 

Detailed Description

Definition at line 210 of file Utilities.py.

Member Function Documentation

def Utilities.TestModuleCommand.setup (   self)

Definition at line 211 of file Utilities.py.

212  def setup(self):
None
def Utilities.TestModuleCommand.testConfig (   self)

Definition at line 213 of file Utilities.py.

214  def testConfig(self):
215  import FWCore.ParameterSet.Config as cms
216  process = cms.Process("Test")
217 
218  process.a = cms.EDProducer("A")
219  process.b = cms.EDProducer("B")
220  process.c = cms.EDProducer("C")
221 
222  process.p = cms.Path(process.b*process.c)
223 
224  process.d = cms.EDAnalyzer("D")
225 
226  process.o = cms.OutputModule("MyOutput")
227  process.out = cms.EndPath(process.o)
228  removeModulesNotOnAPathExcluding(process,(process.b,))
229 
230  self.assert_(not hasattr(process,'a'))
231  self.assert_(hasattr(process,'b'))
232  self.assert_(hasattr(process,'c'))
233  self.assert_(not hasattr(process,'d'))
self.assert_(hasattr(process,'o'))
def removeModulesNotOnAPathExcluding
Definition: Utilities.py:1
def Utilities.TestModuleCommand.testNoSchedule (   self)

Definition at line 234 of file Utilities.py.

References Utilities.convertToUnscheduled().

235  def testNoSchedule(self):
236  import FWCore.ParameterSet.Config as cms
237  process = cms.Process("TEST")
238  process.a = cms.EDProducer("AProd")
239  process.b = cms.EDProducer("BProd")
240  process.c = cms.EDProducer("CProd")
241  process.d = cms.EDProducer("DProd",
242  par1 = cms.InputTag("f1"))
243  process.e = cms.EDProducer("EProd",
244  par1 = cms.VInputTag(cms.InputTag("x"), cms.InputTag("f1", "y")))
245  process.f = cms.EDProducer("FProd",
246  par1 = cms.VInputTag("x","y","f1"))
247  process.g = cms.EDProducer("GProd",
248  par1 = cms.InputTag("f"))
249  process.h = cms.EDProducer("HProd",
250  par1 = cms.bool(True),
251  par2 = cms.PSet(
252  par21 = cms.VPSet(
253  cms.PSet(foo = cms.bool(True)),
254  cms.PSet(
255  foo4 = cms.PSet(
256  bar = cms.bool(True),
257  foo1 = cms.InputTag("f1"),
258  foo2 = cms.VInputTag(cms.InputTag("x"), cms.InputTag("f11", "y")),
259  foo3 = cms.VInputTag("q","r","s"))
260  )
261  )
262  )
263  )
264  process.k = cms.EDProducer("KProd",
265  par1 = cms.bool(True),
266  par2 = cms.PSet(
267  par21 = cms.VPSet(
268  cms.PSet(foo = cms.bool(True)),
269  cms.PSet(
270  foo4 = cms.PSet(
271  bar = cms.bool(True),
272  xSrc = cms.string("f")
273  )
274  )
275  )
276  )
277  )
278  process.f1 = cms.EDFilter("Filter")
279  process.f2 = cms.EDFilter("Filter2")
280  process.f3 = cms.EDFilter("Filter3")
281  process.p1 = cms.Path(process.a+process.b+process.f1+process.d+process.e+process.f+process.g+process.h+process.k)
282  process.p4 = cms.Path(process.a+process.f2+process.b+process.f1)
283  process.p2 = cms.Path(process.a+process.b)
284  process.p3 = cms.Path(process.f1)
285  convertToUnscheduled(process)
286  self.assertEqual(process.options.allowUnscheduled, cms.untracked.bool(True))
287  self.assert_(hasattr(process,'p2'))
288  self.assert_(hasattr(process,'a'))
289  self.assert_(hasattr(process,'b'))
290  self.assert_(not hasattr(process,'c'))
291  self.assert_(hasattr(process,'d'))
292  self.assert_(hasattr(process,'e'))
293  self.assert_(hasattr(process,'f'))
294  self.assert_(hasattr(process,'g'))
295  self.assert_(hasattr(process,'f1'))
296  self.assert_(hasattr(process,'f2'))
297  self.assert_(not hasattr(process,'f3'))
298  self.assertEqual(process.p1.dumpPython(None),'cms.Path(process.f1+process.d+process.e+process.f+process.g+process.h+process.k)\n')
299  self.assertEqual(process.p2.dumpPython(None),'cms.Path()\n')
300  self.assertEqual(process.p3.dumpPython(None),'cms.Path(process.f1)\n')
self.assertEqual(process.p4.dumpPython(None),'cms.Path(process.f2+process.f1)\n')
def convertToUnscheduled
Definition: Utilities.py:69
def Utilities.TestModuleCommand.testWithSchedule (   self)

Definition at line 301 of file Utilities.py.

References Utilities.convertToUnscheduled().

302  def testWithSchedule(self):
303  import FWCore.ParameterSet.Config as cms
304  process = cms.Process("TEST")
305  process.a = cms.EDProducer("AProd")
306  process.b = cms.EDProducer("BProd")
307  process.c = cms.EDProducer("CProd")
308  process.d = cms.EDProducer("DProd",
309  par1 = cms.InputTag("f1"))
310  process.e = cms.EDProducer("EProd",
311  par1 = cms.VInputTag(cms.InputTag("x"), cms.InputTag("f1", "y")))
312  process.f = cms.EDProducer("FProd",
313  par1 = cms.VInputTag("x","y","f1"))
314  process.g = cms.EDProducer("GProd",
315  par1 = cms.InputTag("f"))
316  process.f1 = cms.EDFilter("Filter")
317  process.f2 = cms.EDFilter("Filter2")
318  process.f3 = cms.EDFilter("Filter3")
319  process.p1 = cms.Path(process.a+process.b+process.f1+process.d+process.e+process.f+process.g)
320  process.p4 = cms.Path(process.a+process.f2+process.b+process.f1)
321  process.p2 = cms.Path(process.a+process.b)
322  process.p3 = cms.Path(process.f1)
323  process.schedule = cms.Schedule(process.p1,process.p4,process.p2,process.p3)
324  convertToUnscheduled(process)
325  self.assertEqual(process.options.allowUnscheduled,cms.untracked.bool(True))
326  self.assert_(hasattr(process,'p2'))
327  self.assert_(hasattr(process,'a'))
328  self.assert_(hasattr(process,'b'))
329  self.assert_(not hasattr(process,'c'))
330  self.assert_(hasattr(process,'d'))
331  self.assert_(hasattr(process,'e'))
332  self.assert_(hasattr(process,'f'))
333  self.assert_(hasattr(process,'g'))
334  self.assert_(hasattr(process,'f1'))
335  self.assert_(hasattr(process,'f2'))
336  self.assert_(not hasattr(process,'f3'))
337  self.assertEqual(process.p1.dumpPython(None),'cms.Path(process.f1+process.d+process.e+process.f+process.g)\n')
338  self.assertEqual(process.p2.dumpPython(None),'cms.Path()\n')
339  self.assertEqual(process.p3.dumpPython(None),'cms.Path(process.f1)\n')
340  self.assertEqual(process.p4.dumpPython(None),'cms.Path(process.f2+process.f1)\n')
341  self.assertEqual([p for p in process.schedule],[process.p1,process.p4,process.p2,process.p3])
342 
unittest.main()
def convertToUnscheduled
Definition: Utilities.py:69