regtest/HTMLReport.py | 15 +++++++++++---- regtest/commands/create-report.py | 4 ++++ 2 files changed, 15 insertions(+), 4 deletions(-)
New commits: commit 9f953e47a6ea92d806aeea61e227af54c889c6be Author: Carlos Garcia Campos <[email protected]> Date: Mon Oct 27 19:53:28 2014 +0100 regtest: Add an option to create the HTML report without absolute paths It uses the paths as received from the command line attributes. diff --git a/regtest/HTMLReport.py b/regtest/HTMLReport.py index 0655e99..3423b91 100644 --- a/regtest/HTMLReport.py +++ b/regtest/HTMLReport.py @@ -161,11 +161,15 @@ class BackendTestResult: def get_failed_html(self): html = "" for result in self._results: - actual = os.path.abspath(os.path.join(self._outdir, self._test, result)) - expected = os.path.abspath(os.path.join(self._refsdir, self._test, result)) + actual = os.path.join(self._outdir, self._test, result) + if self.config.abs_paths: + actual = os.path.abspath(actual) + expected = os.path.join(self._refsdir, self._test, result) + if self.config.abs_paths: + expected = os.path.abspath(expected) html += "<li><a href='%s'>actual</a> <a href='%s'>expected</a> " % (actual, expected) if self._backend.has_diff(actual): - diff = os.path.abspath(actual + self._backend.get_diff_ext()) + diff = actual + self._backend.get_diff_ext() html += "<a href='%s'>diff</a> " % (diff) if self.config.pretty_diff: pretty_diff = create_pretty_diff(self._backend) @@ -183,6 +187,7 @@ class TestResult: def __init__(self, docsdir, refsdir, outdir, resultdir, results, backends): self._refsdir = refsdir self._outdir = outdir + self.config = Config() self._test = resultdir[len(self._outdir):].lstrip('/') self._doc = os.path.join(docsdir, self._test) @@ -214,7 +219,9 @@ class TestResult: html += "<li>%s " % (backend.get_name()) stderr = self._results[backend].get_stderr() if os.path.exists(stderr): - html += "<a href='%s'>stderr</a>" % (os.path.abspath(stderr)) + if self.config.abs_paths: + stderr = os.path.abspath(stderr) + html += "<a href='%s'>stderr</a>" % (stderr) html += "</li>\n%s" % (backend_html) if html: diff --git a/regtest/commands/create-report.py b/regtest/commands/create-report.py index e356cf9..ab37d08 100644 --- a/regtest/commands/create-report.py +++ b/regtest/commands/create-report.py @@ -43,11 +43,15 @@ class CreateReport(Command): parser.add_argument('-n', '--no-browser', action = 'store_false', dest = 'launch_browser', default = True, help = 'Do not launch a web browser with the results') + parser.add_argument('--no-absolute-paths', + action = 'store_false', dest = 'use_abs_paths', default = True, + help = 'Do use absolute paths in the generated HTML') parser.add_argument('tests') def run(self, options): config = Config() config.pretty_diff = options['pretty_diff'] + config.abs_paths = options['use_abs_paths'] doc = options['tests'] if os.path.isdir(doc): _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
