Skip to content

Commit

Permalink
Bug 1613937 - Normalize marionette-test manifest and test IDs; r=whim…
Browse files Browse the repository at this point in the history
…boo,marionette-reviewers

Consistently use the relative path, with posix path separators, as the logging ID
used for tests and manifests.

Differential Revision: https://phabricator.services.mozilla.com/D62505

--HG--
extra : moz-landing-system : lando
  • Loading branch information
gbrownmozilla committed Feb 12, 2020
1 parent ea1f257 commit 82ddf88
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def add_tests_to_suite(cls, mod_name, filepath, suite, testloader, marionette,
def test_name(self):
rel_path = None
if os.path.exists(self.filepath):
rel_path = self._fix_test_path(os.path.relpath(self.filepath))
rel_path = self._fix_test_path(self.filepath)

return '{0} {1}.{2}'.format(rel_path,
self.__class__.__name__,
Expand Down Expand Up @@ -276,10 +276,13 @@ def _fix_test_path(self, path):
"tests{}".format(os.path.sep),
]

path = os.path.relpath(path)
for prefix in test_path_prefixes:
if path.startswith(prefix):
path = path[len(prefix):]
break
path = path.replace('\\', '/')

return path


Expand Down
9 changes: 7 additions & 2 deletions testing/marionette/harness/marionette_harness/runner/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,17 +819,20 @@ def _fix_test_path(self, path):
"tests{}".format(os.path.sep),
]

path = os.path.relpath(path)
for prefix in test_path_prefixes:
if path.startswith(prefix):
path = path[len(prefix):]
break
path = path.replace('\\', '/')

return path

def _log_skipped_tests(self):
for test in self.manifest_skipped_tests:
rel_path = None
if os.path.exists(test['path']):
rel_path = self._fix_test_path(os.path.relpath(test['path']))
rel_path = self._fix_test_path(test['path'])

self.logger.test_start(rel_path)
self.logger.test_end(rel_path,
Expand Down Expand Up @@ -866,7 +869,9 @@ def run_tests(self, tests):

tests_by_group = defaultdict(list)
for test in self.tests:
tests_by_group[test['group']].append(test['filepath'])
group = self._fix_test_path(test['group'])
filepath = self._fix_test_path(test['filepath'])
tests_by_group[group].append(filepath)

self.logger.suite_start(tests_by_group,
name='marionette-test',
Expand Down

0 comments on commit 82ddf88

Please sign in to comment.