提交 aa9ca899 编写于 作者: C Cleber Rosa

Result: do not keep track of all of the application processed arguments

It's been a common pattern in Avocado to expose the complete set of
processed arguments to a lot of core components.  This makes the
dependencies and interfaces between these components much less clear.

As we clean up the Result class to make it just a result data container,
let's remove the reference to the processed arguments and keep track
of only the information that's relevant to a given Result implementation.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 c3586a1d
......@@ -34,7 +34,7 @@ class RemoteResult(HumanResult):
HumanResult.__init__(self, job)
self.test_dir = os.getcwd()
self.remote_test_dir = '~/avocado/tests'
self.urls = self.args.url
self.urls = job.args.url
self.remote = None # Remote runner initialized during setup
self.output = '-'
......
......@@ -96,8 +96,7 @@ class Result(object):
"""
self.job_unique_id = getattr(job, "unique_id", None)
self.logfile = getattr(job, "logfile", None)
self.args = getattr(job, "args", None)
self.tests_total = getattr(self.args, 'test_result_total', 1)
self.tests_total = getattr(job.args, 'test_result_total', 1)
self.tests_run = 0
self.tests_total_time = 0.0
self.passed = 0
......@@ -194,6 +193,7 @@ class HumanResult(Result):
super(HumanResult, self).__init__(job)
self.log = logging.getLogger("avocado.app")
self.__throbber = output.Throbber()
self._replay_source_job = getattr(job.args, "replay_sourcejob", None)
def start_tests(self):
"""
......@@ -201,8 +201,8 @@ class HumanResult(Result):
"""
super(HumanResult, self).start_tests()
self.log.info("JOB ID : %s", self.job_unique_id)
if getattr(self.args, "replay_sourcejob", None):
self.log.info("SRC JOB ID : %s", self.args.replay_sourcejob)
if self._replay_source_job is not None:
self.log.info("SRC JOB ID : %s", self._replay_source_job)
self.log.info("JOB LOG : %s", self.logfile)
self.log.info("TESTS : %s", self.tests_total)
......
......@@ -34,7 +34,7 @@ class TAPResult(Result):
"""
return self.output.write(msg % args + "\n")
super(TAPResult, self).__init__(job)
self.output = force_output_file or getattr(self.args, 'tap', '-')
self.output = force_output_file or getattr(job.args, 'tap', '-')
if self.output != '-':
self.output = open(self.output, "w", 1)
self.__write = writeln
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册