From 04f0d97d5666388626461ba6fadf12537ce1e029 Mon Sep 17 00:00:00 2001 From: Dave Hunt Date: Fri, 10 Feb 2017 18:48:22 +0000 Subject: [PATCH] Bug 1338528 - [mozlog] Remove formatting of node ID to allow classes and reduce chance of duplicates. r=ahal Stripping the path from the test file could cause duplicates if two files had the same name in different directories. Splitting on '::' also causes an issue when test classes are used and there are too many values to unpack. MozReview-Commit-ID: Ex5nHl3SGaQ --HG-- extra : rebase_source : 13198d8a886928402b6b079c441e8b1d675ebfa1 --- testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py b/testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py index 811ee38e383e..c7138b58eb2f 100644 --- a/testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py +++ b/testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py @@ -3,7 +3,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import mozlog -import os import time @@ -37,11 +36,6 @@ class MozLog(object): self.results = {} self.start_time = int(time.time() * 1000) # in ms for Mozlog compatibility - def format_nodeid(self, nodeid): - '''Helper to Reformat/shorten a "::"-separated pytest test nodeid''' - testfile, testname = nodeid.split("::") - return " ".join([os.path.basename(testfile), testname]) - def pytest_configure(self, config): mozlog.commandline.setup_logging('pytest', config.known_args_namespace, defaults={}, allow_unused_options=True) @@ -59,7 +53,7 @@ class MozLog(object): self.logger.suite_end() def pytest_runtest_logstart(self, nodeid, location): - self.logger.test_start(test=self.format_nodeid(nodeid)) + self.logger.test_start(test=nodeid) def pytest_runtest_logreport(self, report): '''Called 3 times per test (setup, call, teardown), indicated by report.when''' @@ -89,6 +83,5 @@ class MozLog(object): if report.when == 'teardown': defaults = ('PASS', 'PASS', None, None) status, expected, message, stack = self.results.get(test, defaults) - self.logger.test_end(test=self.format_nodeid(test), - status=status, expected=expected, + self.logger.test_end(test=test, status=status, expected=expected, message=message, stack=stack)