MCPcopy Create free account
hub / github.com/FDio/vpp / wait_for_event

Method wait_for_event

test/vpp_papi_provider.py:312–328  ·  view source on GitHub ↗

Wait for and return next event.

(self, timeout, name=None)

Source from the content-addressed store, hash-verified

310 return result
311
312 def wait_for_event(self, timeout, name=None):
313 """Wait for and return next event."""
314 if name:
315 self.test_class.logger.debug(
316 "Expecting event '%s' within %ss", name, timeout
317 )
318 else:
319 self.test_class.logger.debug("Expecting event within %ss", timeout)
320 try:
321 e = self._events.get(timeout=timeout)
322 except queue.Empty:
323 raise Exception("Event did not occur within timeout")
324 msgname = type(e).__name__
325 if name and msgname != name:
326 raise Exception("Unexpected event received: %s, expected: %s" % msgname)
327 self.test_class.logger.debug("Returning event %s:%s" % (name, e))
328 return e
329
330 def __call__(self, name, event):
331 """Enqueue event in the internal event queue."""

Calls 1

getMethod · 0.45