Bug 1355630 - Extract set declaration to member variable; r?chmanchester
The variable is deterministic. We can call this function thousands of
times. There's no need to populate the set on every invocation.
MozReview-Commit-ID: 1N9JE980Npt
--- a/python/mozbuild/mozbuild/frontend/reader.py
+++ b/python/mozbuild/mozbuild/frontend/reader.py
@@ -1393,24 +1393,28 @@ class BuildReader(object):
if not any([flags.test_tags, flags.test_files, flags.test_flavors]):
flags += self.test_defaults_for_path(ctxs)
r[path] = flags
return r
+ # This names the context keys that will end up emitting a test
+ # manifest.
+ TEST_MANIFEST_CONTEXTS = set(
+ ['%s_MANIFESTS' % key for key in TEST_MANIFESTS] +
+ ['%s_MANIFESTS' % flavor.upper() for flavor in REFTEST_FLAVORS] +
+ ['%s_MANIFESTS' % flavor.upper().replace('-', '_') for flavor in
+ WEB_PLATFORM_TESTS_FLAVORS]
+ )
+
def test_defaults_for_path(self, ctxs):
- # This names the context keys that will end up emitting a test
- # manifest.
- test_manifest_contexts = set(
- ['%s_MANIFESTS' % key for key in TEST_MANIFESTS] +
- ['%s_MANIFESTS' % flavor.upper() for flavor in REFTEST_FLAVORS] +
- ['%s_MANIFESTS' % flavor.upper().replace('-', '_') for flavor in WEB_PLATFORM_TESTS_FLAVORS]
- )
+ # Alias to local because used in tight loop.
+ test_manifest_contexts = self.TEST_MANIFEST_CONTEXTS
result_context = Files(Context())
for ctx in ctxs:
for key in ctx:
if key not in test_manifest_contexts:
continue
for paths, obj in ctx[key]:
if isinstance(paths, tuple):