From 9a54d2f365ae14b46940263714cf731d7df7fc8c Mon Sep 17 00:00:00 2001 From: Joel Bender Date: Tue, 19 Sep 2017 02:57:37 -0400 Subject: [PATCH] add a little more to the debugging output --- tests/time_machine.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/time_machine.py b/tests/time_machine.py index c923a6d..140328b 100755 --- a/tests/time_machine.py +++ b/tests/time_machine.py @@ -42,29 +42,29 @@ class TimeMachine(_TaskManager): time_machine = self def get_time(self): - if _debug: TimeMachine._debug("get_time") + if _debug: TimeMachine._debug("get_time @ %r:", self.current_time) # return the fake time return self.current_time def install_task(self, task): - if _debug: TimeMachine._debug("install_task %r @ %r", task, task.taskTime) + if _debug: TimeMachine._debug("install_task @ %r: %r @ %r", self.current_time, task, task.taskTime) _TaskManager.install_task(self, task) def suspend_task(self, task): - if _debug: TimeMachine._debug("suspend_task %r", task) + if _debug: TimeMachine._debug("suspend_task @ %r: %r", self.current_time, task) _TaskManager.suspend_task(self, task) def resume_task(self, task): - if _debug: TimeMachine._debug("resume_task %r", task) + if _debug: TimeMachine._debug("resume_task @ %r: %r", self.current_time, task) _TaskManager.resume_task(self, task) def more_to_do(self): """Get the next task if there's one that should be processed.""" - if _debug: TimeMachine._debug("more_to_do @ %r", self.current_time) + if _debug: TimeMachine._debug("more_to_do @ %r:", self.current_time) # check if there are deferred functions if _core.deferredFns: @@ -96,7 +96,7 @@ class TimeMachine(_TaskManager): """get the next task if there's one that should be processed, and return how long it will be until the next one should be processed.""" - if _debug: TimeMachine._debug("get_next_task @ %r", self.current_time) + if _debug: TimeMachine._debug("get_next_task @ %r:", self.current_time) if _debug: TimeMachine._debug(" - time_limit: %r", self.time_limit) if _debug: TimeMachine._debug(" - tasks: %r", self.tasks) @@ -136,7 +136,7 @@ class TimeMachine(_TaskManager): return (task, delta) def process_task(self, task): - if _debug: TimeMachine._debug("process_task %r", task) + if _debug: TimeMachine._debug("process_task @ %r: %r", self.current_time, task) _TaskManager.process_task(self, task) @@ -180,6 +180,10 @@ def run_time_machine(time_limit): # pass the limit to the time machine time_machine.time_limit = time_machine.current_time + time_limit + # check if there are deferred functions + if _core.deferredFns: + if _debug: run_time_machine._debug(" - deferred functions!") + # run until there is nothing left to do while True: _core.run_once()