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

Member Function Documentation

def Utilities.TestModuleCommand.setup (   self)

Definition at line 232 of file Utilities.py.

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

Definition at line 234 of file Utilities.py.

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

References Utilities.convertToUnscheduled().

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

References Utilities.convertToUnscheduled().

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