commit e42b8069e24b4f1e796dec4da11b254976af3352
parent f063a98a3dbb6ade3fc46694c7ac9f9946874612
Author: abhishekmadan30 <amadan@mozilla.com>
Date: Wed, 7 Jan 2026 15:50:03 +0000
Bug 2008795 - Cached look-up and switch to rsplit instead of urlsplit in TestResolver.get_wpt_group.r=releng-reviewers,bhearsum
Differential Revision: https://phabricator.services.mozilla.com/D278034
Diffstat:
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/testing/mozbase/moztest/moztest/resolve.py b/testing/mozbase/moztest/moztest/resolve.py
@@ -9,7 +9,6 @@ import sys
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from functools import lru_cache
-from urllib.parse import urlsplit
import mozpack.path as mozpath
from manifestparser import TestManifest, combine_fields
@@ -1146,34 +1145,36 @@ class TestResolver(MozbuildObject):
Returns:
str: The group the given test belongs to.
"""
+ name = test["name"]
+
# This takes into account that for mozilla-specific WPT tests, the path
# contains an extra '/_mozilla' prefix that must be accounted for.
- if test["name"].startswith("/_mozilla"):
+ if name.startswith("/_mozilla"):
depth = depth + 1
# Webdriver tests are nested in "classic" and "bidi" folders. Increase
# the depth to avoid grouping all classic or bidi tests in one chunk.
- if test["name"].startswith(("/webdriver", "/_mozilla/webdriver")):
+ if name.startswith(("/webdriver", "/_mozilla/webdriver")):
depth = depth + 1
# Webdriver BiDi tests are nested even further as tests are grouped by
# module but also by command / event name.
- if test["name"].startswith(
- ("/webdriver/tests/bidi", "/_mozilla/webdriver/bidi")
- ):
+ if name.startswith(("/webdriver/tests/bidi", "/_mozilla/webdriver/bidi")):
depth = depth + 1
# wpt canvas tests are mostly nested under subfolders of /html/canvas,
# increase the depth to ensure chunks can be balanced correctly.
- if test["name"].startswith("/html/canvas"):
+ if name.startswith("/html/canvas"):
depth = depth + 1
- if test["name"].startswith("/_mozilla/webgpu"):
+ if name.startswith("/_mozilla/webgpu"):
depth = 9001
# We have a leading / so the first component is always ""
components = depth + 1
- return "/".join(urlsplit(test["name"]).path.split("/")[:-1][:components])
+
+ path = name.split("?", 1)[0].split("#", 1)[0]
+ return "/".join(path.rsplit("/", 1)[0].split("/")[:components])
def add_wpt_manifest_data(self):
"""Adds manifest data for web-platform-tests into the list of available tests.