From e79162ae8cdd28a2d9f9afcdbf32185ae78e3a59 Mon Sep 17 00:00:00 2001 From: Lucas Meneghel Rodrigues Date: Wed, 6 Aug 2014 19:51:43 -0300 Subject: [PATCH] avocado.job: Call throbber progress conditionally Previously, the throbber update method was being called unconditionally, making throbber progress to appear even when human output was not enabled. Fix this by making a proxy method that calls it only if there is a human plugin enabled, in TestResultProxy. Signed-off-by: Lucas Meneghel Rodrigues --- avocado/job.py | 2 +- avocado/result.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/avocado/job.py b/avocado/job.py index 8357387d..70b1b83d 100644 --- a/avocado/job.py +++ b/avocado/job.py @@ -184,7 +184,7 @@ class TestRunner(object): test_state = q.get(timeout=cycle_timeout) except Queue.Empty: if p.is_alive(): - self.job.output_manager.throbber_progress() + self.job.result_proxy.throbber_progress() else: should_quit = True diff --git a/avocado/result.py b/avocado/result.py index 0cc87766..ccaf8a68 100644 --- a/avocado/result.py +++ b/avocado/result.py @@ -38,6 +38,11 @@ class TestResultProxy(object): else: return None + def throbber_progress(self): + for output_plugin in self.output_plugins: + if hasattr(output_plugin, 'throbber_progress'): + output_plugin.throbber_progress() + def add_output_plugin(self, plugin): if not isinstance(plugin, TestResult): raise InvalidOutputPlugin("Object %s is not an instance of " @@ -323,3 +328,6 @@ class HumanTestResult(TestResult): """ TestResult.add_warn(self, state) self.stream.log_warn(state['time_elapsed']) + + def throbber_progress(self): + self.stream.throbber_progress() -- GitLab