summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/tools
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:26 +0000
commitfcea19dfd2c426bac0456da850e7c12258e4b9eb (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/tools
parentAdding upstream version 115.7.0esr. (diff)
downloadfirefox-esr-fcea19dfd2c426bac0456da850e7c12258e4b9eb.tar.xz
firefox-esr-fcea19dfd2c426bac0456da850e7c12258e4b9eb.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/tools')
-rw-r--r--testing/web-platform/tests/tools/runner/update_manifest.py6
-rw-r--r--testing/web-platform/tests/tools/wpt/utils.py15
-rw-r--r--testing/web-platform/tests/tools/wptrunner/wptrunner/stability.py8
3 files changed, 22 insertions, 7 deletions
diff --git a/testing/web-platform/tests/tools/runner/update_manifest.py b/testing/web-platform/tests/tools/runner/update_manifest.py
index a7f72b35b3..58b9ac4d84 100644
--- a/testing/web-platform/tests/tools/runner/update_manifest.py
+++ b/testing/web-platform/tests/tools/runner/update_manifest.py
@@ -1,16 +1,18 @@
# mypy: ignore-errors
-import imp
import json
import os
+from tools.wpt.utils import load_source
+
here = os.path.dirname(__file__)
-localpaths = imp.load_source("localpaths", os.path.abspath(os.path.join(here, os.pardir, "localpaths.py")))
+localpaths = load_source("localpaths", os.path.abspath(os.path.join(here, os.pardir, "localpaths.py")))
root = localpaths.repo_root
from manifest import manifest
+
def main(request, response):
path = os.path.join(root, "MANIFEST.json")
diff --git a/testing/web-platform/tests/tools/wpt/utils.py b/testing/web-platform/tests/tools/wpt/utils.py
index b015b95e1a..5899dc3f3a 100644
--- a/testing/web-platform/tests/tools/wpt/utils.py
+++ b/testing/web-platform/tests/tools/wpt/utils.py
@@ -3,10 +3,10 @@
import errno
import logging
import os
-import sys
import shutil
import stat
import subprocess
+import sys
import tarfile
import time
import zipfile
@@ -166,3 +166,16 @@ def sha256sum(file_path):
for chunk in iter(lambda: f.read(4096), b''):
hash.update(chunk)
return hash.hexdigest()
+
+
+# see https://docs.python.org/3/whatsnew/3.12.html#imp
+def load_source(modname, filename):
+ import importlib.machinery
+ import importlib.util
+
+ loader = importlib.machinery.SourceFileLoader(modname, filename)
+ spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
+ module = importlib.util.module_from_spec(spec)
+ sys.modules[module.__name__] = module
+ loader.exec_module(module)
+ return module
diff --git a/testing/web-platform/tests/tools/wptrunner/wptrunner/stability.py b/testing/web-platform/tests/tools/wptrunner/wptrunner/stability.py
index 9ac6249c44..1f17ef3c47 100644
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/stability.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/stability.py
@@ -2,7 +2,6 @@
import copy
import functools
-import imp
import io
import os
from collections import OrderedDict, defaultdict
@@ -10,16 +9,17 @@ from datetime import datetime
from mozlog import reader
from mozlog.formatters import JSONFormatter
-from mozlog.handlers import BaseHandler, StreamHandler, LogLevelFilter
+from mozlog.handlers import BaseHandler, LogLevelFilter, StreamHandler
+
+from tools.wpt.utils import load_source
from . import wptrunner
here = os.path.dirname(__file__)
-localpaths = imp.load_source("localpaths", os.path.abspath(os.path.join(here, os.pardir, os.pardir, "localpaths.py")))
+localpaths = load_source("localpaths", os.path.abspath(os.path.join(here, os.pardir, os.pardir, "localpaths.py")))
from ci.tc.github_checks_output import get_gh_checks_outputter # type: ignore
from wpt.markdown import markdown_adjust, table # type: ignore
-
# If a test takes more than (FLAKY_THRESHOLD*timeout) and does not consistently
# time out, it is considered slow (potentially flaky).
FLAKY_THRESHOLD = 0.8