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

Member Function Documentation

def Utilities.TestModuleCommand.setup (   self)

Definition at line 210 of file Utilities.py.

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

Definition at line 212 of file Utilities.py.

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

References Utilities.convertToUnscheduled().

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

References Utilities.convertToUnscheduled().

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