From 5cf5736d6488ad2536f27a4afd327d611a1fe5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rud=C3=A1=20Moura?= Date: Tue, 17 Mar 2015 17:15:42 -0300 Subject: [PATCH] avocado app: Review command line options regarding test results output. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Group together jsonresult, xunitresult, htmlresult and journal inside "output related arguments". Side effect: export `self.parser.runner.output` to the plugins. Signed-off-by: Rudá Moura --- avocado/plugins/htmlresult.py | 6 +++--- avocado/plugins/journal.py | 2 +- avocado/plugins/jsonresult.py | 2 +- avocado/plugins/runner.py | 33 ++++++++++++++++++--------------- avocado/plugins/xunit.py | 2 +- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/avocado/plugins/htmlresult.py b/avocado/plugins/htmlresult.py index 03b1640a..e743513c 100644 --- a/avocado/plugins/htmlresult.py +++ b/avocado/plugins/htmlresult.py @@ -296,7 +296,7 @@ class HTML(plugin.Plugin): self.enabled = False return self.parser = parser - self.parser.runner.add_argument( + self.parser.runner.output.add_argument( '--html', type=str, dest='html_output', help=('Enable HTML output to the file where the result should be ' @@ -304,14 +304,14 @@ class HTML(plugin.Plugin): 'since not all HTML resources can be embedded into a ' 'single file (page resources will be copied to the ' 'output file dir)')) - self.parser.runner.add_argument( + self.parser.runner.output.add_argument( '--relative-links', dest='relative_links', action='store_true', default=False, help=('On the HTML report, generate anchor links with relative ' 'instead of absolute paths. Current: %s' % False)) - self.parser.runner.add_argument( + self.parser.runner.output.add_argument( '--open-browser', dest='open_browser', action='store_true', diff --git a/avocado/plugins/journal.py b/avocado/plugins/journal.py index 8ce237cf..0dc1694a 100644 --- a/avocado/plugins/journal.py +++ b/avocado/plugins/journal.py @@ -123,7 +123,7 @@ class Journal(plugin.Plugin): def configure(self, parser): self.parser = parser - self.parser.runner.add_argument( + self.parser.runner.output.add_argument( '--journal', action='store_true', help='Records test status changes') self.configured = True diff --git a/avocado/plugins/jsonresult.py b/avocado/plugins/jsonresult.py index 178cd7fe..a9fc6a44 100644 --- a/avocado/plugins/jsonresult.py +++ b/avocado/plugins/jsonresult.py @@ -102,7 +102,7 @@ class JSON(plugin.Plugin): def configure(self, parser): self.parser = parser - self.parser.runner.add_argument( + self.parser.runner.output.add_argument( '--json', type=str, dest='json_output', help='Enable JSON output to the file where the result should be written. ' diff --git a/avocado/plugins/runner.py b/avocado/plugins/runner.py index 275e92f9..1aafacd0 100644 --- a/avocado/plugins/runner.py +++ b/avocado/plugins/runner.py @@ -77,21 +77,24 @@ class TestRunner(plugin.Plugin): '(hardware details, profilers, etc.). ' 'Current: %(default)s')) - out = self.parser.add_argument_group('output related arguments') - - out.add_argument('-s', '--silent', action='store_true', default=False, - help='Silence stdout') - - out.add_argument('--show-job-log', action='store_true', default=False, - help=('Display only the job log on stdout. Useful ' - 'for test debugging purposes. No output will ' - 'be displayed if you also specify --silent')) - - out.add_argument('--job-log-level', action='store', - help=("Log level of the job log. Options: " - "'debug', 'info', 'warning', 'error', " - "'critical'. Current: debug"), - default='debug') + self.parser.output = self.parser.add_argument_group('output related arguments') + + self.parser.output.add_argument( + '-s', '--silent', action='store_true', default=False, + help='Silence stdout') + + self.parser.output.add_argument( + '--show-job-log', action='store_true', default=False, + help=('Display only the job log on stdout. Useful ' + 'for test debugging purposes. No output will ' + 'be displayed if you also specify --silent')) + + self.parser.output.add_argument( + '--job-log-level', action='store', + help=("Log level of the job log. Options: " + "'debug', 'info', 'warning', 'error', " + "'critical'. Current: debug"), + default='debug') out_check = self.parser.add_argument_group('output check arguments') diff --git a/avocado/plugins/xunit.py b/avocado/plugins/xunit.py index b34ad7d4..b603e171 100644 --- a/avocado/plugins/xunit.py +++ b/avocado/plugins/xunit.py @@ -227,7 +227,7 @@ class XUnit(plugin.Plugin): def configure(self, parser): self.parser = parser - self.parser.runner.add_argument( + self.parser.runner.output.add_argument( '--xunit', type=str, dest='xunit_output', help=('Enable xUnit output to the file where the result should be written. ' "Use '-' to redirect to the standard output.")) -- GitLab