EventLoop: Fix log error "Origin parent loop" during wait()
Setting the log.ctx manually is not needed anymore and it's actually
harmful since all palces where it was used, a log.Origin already in path
was being passed, causing a origin loop.
Change-Id: I0511b9f7bc59e3c7f2269ff3155d0c95db58d063
diff --git a/src/osmo_gsm_tester/core/event_loop.py b/src/osmo_gsm_tester/core/event_loop.py
index fe88ef4..4092a66 100644
--- a/src/osmo_gsm_tester/core/event_loop.py
+++ b/src/osmo_gsm_tester/core/event_loop.py
@@ -85,9 +85,8 @@
self.gctx.iteration(may_block)
self.deferred_handling.handle_queue()
- def wait_no_raise(self, log_obj, condition, condition_args, condition_kwargs, timeout, timestep):
+ def wait_no_raise(self, condition, condition_args, condition_kwargs, timeout, timestep):
if not timeout or timeout < 0:
- self = log_obj
raise log.Error('wait() *must* time out at some point.', timeout=timeout)
if timestep < 0.1:
timestep = 0.1
@@ -105,14 +104,13 @@
success = wait_req.condition_ack
return success
- def wait(self, log_obj, condition, *condition_args, timeout=300, timestep=1, **condition_kwargs):
- if not self.wait_no_raise(log_obj, condition, condition_args, condition_kwargs, timeout, timestep):
- log.ctx(log_obj)
+ def wait(self, condition, *condition_args, timeout=300, timestep=1, **condition_kwargs):
+ if not self.wait_no_raise(condition, condition_args, condition_kwargs, timeout, timestep):
raise log.Error('Wait timeout', condition=condition, timeout=timeout, timestep=timestep)
- def sleep(self, log_obj, seconds):
+ def sleep(self, seconds):
assert seconds > 0.
- self.wait_no_raise(log_obj, lambda: False, [], {}, timeout=seconds, timestep=seconds)
+ self.wait_no_raise(lambda: False, [], {}, timeout=seconds, timestep=seconds)
MainLoop = EventLoop()