本文整理汇总了Python中EventHandlers.tests.TestEventLogger.expectAtLeastNevents方法的典型用法代码示例。如果您正苦于以下问题:Python TestEventLogger.expectAtLeastNevents方法的具体用法?Python TestEventLogger.expectAtLeastNevents怎么用?Python TestEventLogger.expectAtLeastNevents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventHandlers.tests.TestEventLogger
的用法示例。
在下文中一共展示了TestEventLogger.expectAtLeastNevents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testWebbrickStatusQuery
# 需要导入模块: from EventHandlers.tests import TestEventLogger [as 别名]
# 或者: from EventHandlers.tests.TestEventLogger import expectAtLeastNevents [as 别名]
def testWebbrickStatusQuery(self):
self._log.debug( "\n\ntestWebbrickStatusQuery" )
self.loader = EventRouterLoader()
self.loader.loadHandlers( getDictFromXmlString(testConfigWebbrickStatusQuery) )
self.loader.start() # all tasks
self.router = self.loader.getEventRouter()
self.router.publish( EventAgent("TestWebbrickStatusMonitor"), Events.evtSecond5 ) # so webbrick is in list for recover
self.router.publish( EventAgent("TestWebbrickStatusMonitor"), Events.evtMinute1 ) # do recover
waitNSeconds(2) # recover is async
self.router.publish( EventAgent("TestWebbrickStatusMonitor"), Events.evtSecond5 ) # do scan
waitNSeconds(2) # scan is async
# We should see lots of events here as initial pass.
# my test rig only has 1 temp sensors.
# so:
# 1 temp sensors
# 4 analogue in
# 4 analogue out
# 12 digital in
# 8 digital out
# 8 mimic out
self.assert_( TestEventLogger.expectAtLeastNevents(36+NUM_TEMP_SENSORS), "expecting %u events" % (36+NUM_TEMP_SENSORS) )
oldLen = len(TestEventLogger._events)
self.router.publish( EventAgent("TestWebbrickStatusMonitor"), Events.evtSecond5 ) # do scan
waitNSeconds(2) # scan is async
TestEventLogger.logEvents()
self.assert_( oldLen <= len(TestEventLogger._events) )
示例2: testWebbrickStatusQueryReal
# 需要导入模块: from EventHandlers.tests import TestEventLogger [as 别名]
# 或者: from EventHandlers.tests.TestEventLogger import expectAtLeastNevents [as 别名]
def testWebbrickStatusQueryReal(self):
self._log.debug( "\n\ntestWebbrickStatusQueryReal" )
self.loader = EventRouterLoader()
self.loader.loadHandlers( getDictFromXmlString(testConfigWebbrickStatusQueryReal) )
self.loader.start() # all tasks
self.router = self.loader.getEventRouter()
self.router.publish( EventAgent("TestWebbrickStatusMonitor"), Events.evtSecond5 ) # so webbrick is in list for recover
waitNSeconds(2) # scan is async
self.router.publish( EventAgent("TestWebbrickStatusMonitor"), Events.evtMinute1 ) # do discover
waitNSeconds(30)
self.router.publish( EventAgent("TestWebbrickStatusMonitor"), Events.evtMinute1 ) # do recover
waitNSeconds(2) # recover is async
self.router.publish( EventAgent("TestWebbrickStatusMonitor"), Events.evtSecond5 ) # do scan
waitNSeconds(2) # scan is async
# We should see lots of events here as initial pass.
self.assert_( TestEventLogger.expectAtLeastNevents(10), "expecting %u events" % (10) )