From ca37f985b6803a202cf0b57cbe1c8d92748bef0a Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Mon, 21 Oct 2019 19:24:06 +0000 Subject: [PATCH] Bug 1583353 - [moztest.resolve] Create an 'is_puppeteer_loaded' flag r=gbrown This prevents us from adding the puppeteer tests over and over again. It follows the wpt example. Differential Revision: https://phabricator.services.mozilla.com/D49790 --HG-- extra : moz-landing-system : lando --- testing/mozbase/moztest/moztest/resolve.py | 9 +++++++-- testing/mozbase/moztest/tests/test_resolve.py | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/testing/mozbase/moztest/moztest/resolve.py b/testing/mozbase/moztest/moztest/resolve.py index bd56d350942d..37e14d0038b0 100644 --- a/testing/mozbase/moztest/moztest/resolve.py +++ b/testing/mozbase/moztest/moztest/resolve.py @@ -13,12 +13,11 @@ from collections import defaultdict import manifestparser import mozpack.path as mozpath from mozbuild.base import MozbuildObject -from mozbuild.util import OrderedDefaultDict from mozbuild.frontend.reader import BuildReader, EmptyConfig +from mozbuild.util import OrderedDefaultDict here = os.path.abspath(os.path.dirname(__file__)) - MOCHITEST_CHUNK_BY_DIR = 4 MOCHITEST_TOTAL_CHUNKS = 5 @@ -333,6 +332,7 @@ class TestMetadata(object): self._tests_by_flavor = defaultdict(set) self._test_dirs = set() self._objdir = os.path.abspath(os.path.join(all_tests, os.pardir)) + self._puppeteer_loaded = False self._wpt_loaded = False self._srcdir = srcdir @@ -461,6 +461,9 @@ class TestMetadata(object): return mozpath.match(path, "remote/test/puppeteer/test/**") def add_puppeteer_manifest_data(self): + if self._puppeteer_loaded: + return + test_path = os.path.join(self._srcdir, "remote", "test", "puppeteer", "test") for root, dirs, paths in os.walk(test_path): for filename in fnmatch.filter(paths, "*.spec.js"): @@ -479,6 +482,8 @@ class TestMetadata(object): "srcdir_relpath": path, }) + self._puppeteer_loaded = True + def is_wpt_path(self, path): if path is None: return True diff --git a/testing/mozbase/moztest/tests/test_resolve.py b/testing/mozbase/moztest/tests/test_resolve.py index 11c1de61100f..4b3c4b7da8d2 100644 --- a/testing/mozbase/moztest/tests/test_resolve.py +++ b/testing/mozbase/moztest/tests/test_resolve.py @@ -220,7 +220,9 @@ class Base(unittest.TestCase): self._temp_files.append(test_defaults) rv = TestMetadata(all_tests.name, "/firefox/", test_defaults=test_defaults.name) - rv._wpt_loaded = True # Don't try to load the wpt manifest + # Avoid loading wpt or puppeteer manifests. + rv._wpt_loaded = True + rv._puppeteer_loaded = True return rv