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 testIgnoreFiltersOnPath
 
def testNoSchedule
 
def testWithSchedule
 

Detailed Description

Definition at line 190 of file Utilities.py.

Member Function Documentation

def Utilities.TestModuleCommand.setup (   self)

Definition at line 191 of file Utilities.py.

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

Definition at line 206 of file Utilities.py.

References Utilities.removeModulesNotOnAPathExcluding().

207  def testConfig(self):
208  import FWCore.ParameterSet.Config as cms
209  process = cms.Process("Test")
210 
211  process.a = cms.EDProducer("A")
212  process.b = cms.EDProducer("B")
213  process.c = cms.EDProducer("C")
214 
215  process.p = cms.Path(process.b*process.c)
216 
217  process.d = cms.EDAnalyzer("D")
218 
219  process.o = cms.OutputModule("MyOutput")
220  process.out = cms.EndPath(process.o)
221  removeModulesNotOnAPathExcluding(process,(process.b,))
222 
223  self.assert_(not hasattr(process,'a'))
224  self.assert_(hasattr(process,'b'))
225  self.assert_(hasattr(process,'c'))
226  self.assert_(not hasattr(process,'d'))
self.assert_(hasattr(process,'o'))
def removeModulesNotOnAPathExcluding
Definition: Utilities.py:1
def Utilities.TestModuleCommand.testIgnoreFiltersOnPath (   self)

Definition at line 193 of file Utilities.py.

194  def testIgnoreFiltersOnPath(self):
195  import FWCore.ParameterSet.Config as cms
196  process = cms.Process("Test")
197 
198  process.f1 = cms.EDFilter("F1")
199  process.f2 = cms.EDFilter("F2")
200  process.f3 = cms.EDFilter("F3")
201  process.s = cms.Sequence(process.f3)
202 
203  process.p = cms.Path(process.f1+cms.ignore(process.f2)+process.s)
204  ignoreAllFiltersOnPath(process.p)
205  self.assertEqual(process.p.dumpPython(None),'cms.Path(cms.ignore(process.f1)+cms.ignore(process.f2)+cms.ignore(process.f3))\n')
def ignoreAllFiltersOnPath
Definition: Utilities.py:69
def Utilities.TestModuleCommand.testNoSchedule (   self)

Definition at line 227 of file Utilities.py.

References Utilities.convertToUnscheduled().

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

Definition at line 296 of file Utilities.py.

References Utilities.convertToUnscheduled().

297  def testWithSchedule(self):
298  import FWCore.ParameterSet.Config as cms
299  process = cms.Process("TEST")
300  process.a = cms.EDProducer("AProd")
301  process.b = cms.EDProducer("BProd")
302  process.c = cms.EDProducer("CProd")
303  process.d = cms.EDProducer("DProd",
304  par1 = cms.InputTag("f1"))
305  process.e = cms.EDProducer("EProd",
306  par1 = cms.VInputTag(cms.InputTag("x"), cms.InputTag("f1", "y")))
307  process.f = cms.EDProducer("FProd",
308  par1 = cms.VInputTag("x","y","f1"))
309  process.g = cms.EDProducer("GProd",
310  par1 = cms.InputTag("f"))
311  process.h = cms.EDProducer("HProd",
312  par1 = cms.InputTag("a"))
313  process.f1 = cms.EDFilter("Filter")
314  process.f2 = cms.EDFilter("Filter2")
315  process.f3 = cms.EDFilter("Filter3")
316  process.f4 = cms.EDFilter("Filter4")
317  process.p1 = cms.Path(process.a+process.b+process.f1+process.d+process.e+process.f+process.g)
318  process.p4 = cms.Path(process.a+process.f2+process.b+process.f1)
319  process.p2 = cms.Path(process.a+process.b)
320  process.p3 = cms.Path(process.f1)
321  process.p5 = cms.Path(process.a+process.h+process.f4) #not used on schedule
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.assert_(not hasattr(process,"f4"))
337  self.assert_(not hasattr(process,"h"))
338  self.assert_(not hasattr(process,"p5"))
339  self.assertEqual(process.p1.dumpPython(None),'cms.Path(process.f1)\n')
340  self.assertEqual(process.p2.dumpPython(None),'cms.Path()\n')
341  self.assertEqual(process.p3.dumpPython(None),'cms.Path(process.f1)\n')
342  self.assertEqual(process.p4.dumpPython(None),'cms.Path(process.f2+process.f1)\n')
343 # there is no longer a schedule.
344 # self.assertEqual([p for p in process.schedule],[process.p1,process.p4,process.p2,process.p3])
345 
unittest.main()
def convertToUnscheduled
Definition: Utilities.py:92