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 232 of file Utilities.py.

Member Function Documentation

def Utilities.TestModuleCommand.setup (   self)

Definition at line 233 of file Utilities.py.

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

Definition at line 235 of file Utilities.py.

236  def testConfig(self):
237  import FWCore.ParameterSet.Config as cms
238  process = cms.Process("Test")
239 
240  process.a = cms.EDProducer("A")
241  process.b = cms.EDProducer("B")
242  process.c = cms.EDProducer("C")
243 
244  process.p = cms.Path(process.b*process.c)
245 
246  process.d = cms.EDAnalyzer("D")
247 
248  process.o = cms.OutputModule("MyOutput")
249  process.out = cms.EndPath(process.o)
250  removeModulesNotOnAPathExcluding(process,(process.b,))
251 
252  self.assert_(not hasattr(process,'a'))
253  self.assert_(hasattr(process,'b'))
254  self.assert_(hasattr(process,'c'))
255  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 256 of file Utilities.py.

References Utilities.convertToUnscheduled().

257  def testNoSchedule(self):
258  import FWCore.ParameterSet.Config as cms
259  process = cms.Process("TEST")
260  process.a = cms.EDProducer("AProd")
261  process.b = cms.EDProducer("BProd")
262  process.c = cms.EDProducer("CProd")
263  process.d = cms.EDProducer("DProd",
264  par1 = cms.InputTag("f1"))
265  process.e = cms.EDProducer("EProd",
266  par1 = cms.VInputTag(cms.InputTag("x"), cms.InputTag("f1", "y")))
267  process.f = cms.EDProducer("FProd",
268  par1 = cms.VInputTag("x","y","f1"))
269  process.g = cms.EDProducer("GProd",
270  par1 = cms.InputTag("f"))
271  process.h = cms.EDProducer("HProd",
272  par1 = cms.bool(True),
273  par2 = cms.PSet(
274  par21 = cms.VPSet(
275  cms.PSet(foo = cms.bool(True)),
276  cms.PSet(
277  foo4 = cms.PSet(
278  bar = cms.bool(True),
279  foo1 = cms.InputTag("f1"),
280  foo2 = cms.VInputTag(cms.InputTag("x"), cms.InputTag("f11", "y")),
281  foo3 = cms.VInputTag("q","r","s"))
282  )
283  )
284  )
285  )
286  process.k = cms.EDProducer("KProd",
287  par1 = cms.bool(True),
288  par2 = cms.PSet(
289  par21 = cms.VPSet(
290  cms.PSet(foo = cms.bool(True)),
291  cms.PSet(
292  foo4 = cms.PSet(
293  bar = cms.bool(True),
294  xSrc = cms.string("f")
295  )
296  )
297  )
298  )
299  )
300  process.f1 = cms.EDFilter("Filter")
301  process.f2 = cms.EDFilter("Filter2")
302  process.f3 = cms.EDFilter("Filter3")
303  process.f4 = cms.EDFilter("FIlter4")
304  process.p1 = cms.Path(process.a+process.b+process.f1+process.d+process.e+process.f+process.g+process.h+process.k)
305  process.p4 = cms.Path(process.a+process.f2+process.b+~process.f1+cms.ignore(process.f4))
306  process.p2 = cms.Path(process.a+process.b)
307  process.p3 = cms.Path(process.f1)
308  convertToUnscheduled(process)
309  self.assertEqual(process.options.allowUnscheduled, cms.untracked.bool(True))
310  self.assert_(hasattr(process,'p2'))
311  self.assert_(hasattr(process,'a'))
312  self.assert_(hasattr(process,'b'))
313  self.assert_(not hasattr(process,'c'))
314  self.assert_(hasattr(process,'d'))
315  self.assert_(hasattr(process,'e'))
316  self.assert_(hasattr(process,'f'))
317  self.assert_(hasattr(process,'g'))
318  self.assert_(hasattr(process,'f1'))
319  self.assert_(hasattr(process,'f2'))
320  self.assert_(not hasattr(process,'f3'))
321  self.assert_(hasattr(process,'f4'))
322  self.assertEqual(process.p1.dumpPython(None),'cms.Path(process.f1+process.d+process.e+process.f+process.g+process.h+process.k)\n')
323  self.assertEqual(process.p2.dumpPython(None),'cms.Path()\n')
324  self.assertEqual(process.p3.dumpPython(None),'cms.Path(process.f1)\n')
self.assertEqual(process.p4.dumpPython(None),'cms.Path(process.f2+~process.f1+cms.ignore(process.f4))\n')
def convertToUnscheduled
Definition: Utilities.py:69
def Utilities.TestModuleCommand.testWithSchedule (   self)

Definition at line 325 of file Utilities.py.

References Utilities.convertToUnscheduled().

326  def testWithSchedule(self):
327  import FWCore.ParameterSet.Config as cms
328  process = cms.Process("TEST")
329  process.a = cms.EDProducer("AProd")
330  process.b = cms.EDProducer("BProd")
331  process.c = cms.EDProducer("CProd")
332  process.d = cms.EDProducer("DProd",
333  par1 = cms.InputTag("f1"))
334  process.e = cms.EDProducer("EProd",
335  par1 = cms.VInputTag(cms.InputTag("x"), cms.InputTag("f1", "y")))
336  process.f = cms.EDProducer("FProd",
337  par1 = cms.VInputTag("x","y","f1"))
338  process.g = cms.EDProducer("GProd",
339  par1 = cms.InputTag("f"))
340  process.h = cms.EDProducer("HProd",
341  par1 = cms.InputTag("a"))
342  process.f1 = cms.EDFilter("Filter")
343  process.f2 = cms.EDFilter("Filter2")
344  process.f3 = cms.EDFilter("Filter3")
345  process.f4 = cms.EDFilter("Filter4")
346  process.p1 = cms.Path(process.a+process.b+process.f1+process.d+process.e+process.f+process.g)
347  process.p4 = cms.Path(process.a+process.f2+process.b+process.f1)
348  process.p2 = cms.Path(process.a+process.b)
349  process.p3 = cms.Path(process.f1)
350  process.p5 = cms.Path(process.a+process.h+process.f4) #not used on schedule
351  process.schedule = cms.Schedule(process.p1,process.p4,process.p2,process.p3)
352  convertToUnscheduled(process)
353  self.assertEqual(process.options.allowUnscheduled,cms.untracked.bool(True))
354  self.assert_(hasattr(process,'p2'))
355  self.assert_(hasattr(process,'a'))
356  self.assert_(hasattr(process,'b'))
357  self.assert_(not hasattr(process,'c'))
358  self.assert_(hasattr(process,'d'))
359  self.assert_(hasattr(process,'e'))
360  self.assert_(hasattr(process,'f'))
361  self.assert_(hasattr(process,'g'))
362  self.assert_(hasattr(process,'f1'))
363  self.assert_(hasattr(process,'f2'))
364  self.assert_(not hasattr(process,'f3'))
365  self.assert_(not hasattr(process,"f4"))
366  self.assert_(not hasattr(process,"h"))
367  self.assert_(not hasattr(process,"p5"))
368  self.assertEqual(process.p1.dumpPython(None),'cms.Path(process.f1+process.d+process.e+process.f+process.g)\n')
369  self.assertEqual(process.p2.dumpPython(None),'cms.Path()\n')
370  self.assertEqual(process.p3.dumpPython(None),'cms.Path(process.f1)\n')
371  self.assertEqual(process.p4.dumpPython(None),'cms.Path(process.f2+process.f1)\n')
372 # there is no longer a schedule.
373 # self.assertEqual([p for p in process.schedule],[process.p1,process.p4,process.p2,process.p3])
374 
unittest.main()
def convertToUnscheduled
Definition: Utilities.py:69