diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 15:12:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 15:12:12 +0000 |
commit | a7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431 (patch) | |
tree | 54617b4f5f04ee87a2c9e3b97cc88b8626859124 /testing/web-platform | |
parent | Releasing progress-linux version 115.7.0esr-1~deb12u1progress7u1. (diff) | |
download | firefox-esr-a7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431.tar.xz firefox-esr-a7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431.zip |
Merging upstream version 115.8.0esr.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform')
18 files changed, 70 insertions, 39 deletions
diff --git a/testing/web-platform/manifestupdate.py b/testing/web-platform/manifestupdate.py index 79b7f1ae56..f8f9d08cb9 100644 --- a/testing/web-platform/manifestupdate.py +++ b/testing/web-platform/manifestupdate.py @@ -5,13 +5,13 @@ import argparse import errno import hashlib -import imp import os import sys import manifestdownload import six from mach.util import get_state_dir +from mozfile import load_source from mozlog.structured import commandline from six.moves import configparser from wptrunner import wptcommandline @@ -21,9 +21,7 @@ manifest = None def do_delayed_imports(wpt_dir): global manifest - imp.load_source( - "localpaths", os.path.join(wpt_dir, "tests", "tools", "localpaths.py") - ) + load_source("localpaths", os.path.join(wpt_dir, "tests", "tools", "localpaths.py")) sys.path.insert(0, os.path.join(wpt_dir, "tools", "manifest")) import manifest diff --git a/testing/web-platform/tests/service-workers/service-worker/resources/scope1/redirect.py b/testing/web-platform/tests/service-workers/service-worker/resources/scope1/redirect.py index bb4c874aac..025ea671c5 100644 --- a/testing/web-platform/tests/service-workers/service-worker/resources/scope1/redirect.py +++ b/testing/web-platform/tests/service-workers/service-worker/resources/scope1/redirect.py @@ -1,6 +1,8 @@ import os -import imp + +from tools.wpt.utils import load_source + # Use the file from the parent directory. -mod = imp.load_source("_parent", os.path.join(os.path.dirname(os.path.dirname(__file__)), +mod = load_source("_parent", os.path.join(os.path.dirname(os.path.dirname(__file__)), os.path.basename(__file__))) main = mod.main diff --git a/testing/web-platform/tests/service-workers/service-worker/resources/scope2/worker_interception_redirect_webworker.py b/testing/web-platform/tests/service-workers/service-worker/resources/scope2/worker_interception_redirect_webworker.py index bb4c874aac..025ea671c5 100644 --- a/testing/web-platform/tests/service-workers/service-worker/resources/scope2/worker_interception_redirect_webworker.py +++ b/testing/web-platform/tests/service-workers/service-worker/resources/scope2/worker_interception_redirect_webworker.py @@ -1,6 +1,8 @@ import os -import imp + +from tools.wpt.utils import load_source + # Use the file from the parent directory. -mod = imp.load_source("_parent", os.path.join(os.path.dirname(os.path.dirname(__file__)), +mod = load_source("_parent", os.path.join(os.path.dirname(os.path.dirname(__file__)), os.path.basename(__file__))) main = mod.main diff --git a/testing/web-platform/tests/service-workers/service-worker/resources/subdir/worker_interception_redirect_webworker.py b/testing/web-platform/tests/service-workers/service-worker/resources/subdir/worker_interception_redirect_webworker.py index bb4c874aac..025ea671c5 100644 --- a/testing/web-platform/tests/service-workers/service-worker/resources/subdir/worker_interception_redirect_webworker.py +++ b/testing/web-platform/tests/service-workers/service-worker/resources/subdir/worker_interception_redirect_webworker.py @@ -1,6 +1,8 @@ import os -import imp + +from tools.wpt.utils import load_source + # Use the file from the parent directory. -mod = imp.load_source("_parent", os.path.join(os.path.dirname(os.path.dirname(__file__)), +mod = load_source("_parent", os.path.join(os.path.dirname(os.path.dirname(__file__)), os.path.basename(__file__))) main = mod.main 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 diff --git a/testing/web-platform/tests/xhr/resources/auth1/auth.py b/testing/web-platform/tests/xhr/resources/auth1/auth.py index db4f7bc4c9..3797aaa52e 100644 --- a/testing/web-platform/tests/xhr/resources/auth1/auth.py +++ b/testing/web-platform/tests/xhr/resources/auth1/auth.py @@ -1,12 +1,13 @@ -import imp import os from wptserve.utils import isomorphic_decode +from tools.wpt.utils import load_source + here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__))) def main(request, response): - auth = imp.load_source(u"", os.path.join(here, + auth = load_source(u"", os.path.join(here, u"..", u"authentication.py")) return auth.main(request, response) diff --git a/testing/web-platform/tests/xhr/resources/auth10/auth.py b/testing/web-platform/tests/xhr/resources/auth10/auth.py index db4f7bc4c9..568d31e906 100644 --- a/testing/web-platform/tests/xhr/resources/auth10/auth.py +++ b/testing/web-platform/tests/xhr/resources/auth10/auth.py @@ -1,12 +1,14 @@ -import imp import os from wptserve.utils import isomorphic_decode +from tools.wpt.utils import load_source + here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__))) + def main(request, response): - auth = imp.load_source(u"", os.path.join(here, + auth = load_source(u"", os.path.join(here, u"..", u"authentication.py")) return auth.main(request, response) diff --git a/testing/web-platform/tests/xhr/resources/auth11/auth.py b/testing/web-platform/tests/xhr/resources/auth11/auth.py index db4f7bc4c9..3797aaa52e 100644 --- a/testing/web-platform/tests/xhr/resources/auth11/auth.py +++ b/testing/web-platform/tests/xhr/resources/auth11/auth.py @@ -1,12 +1,13 @@ -import imp import os from wptserve.utils import isomorphic_decode +from tools.wpt.utils import load_source + here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__))) def main(request, response): - auth = imp.load_source(u"", os.path.join(here, + auth = load_source(u"", os.path.join(here, u"..", u"authentication.py")) return auth.main(request, response) diff --git a/testing/web-platform/tests/xhr/resources/auth2/auth.py b/testing/web-platform/tests/xhr/resources/auth2/auth.py index db4f7bc4c9..568d31e906 100644 --- a/testing/web-platform/tests/xhr/resources/auth2/auth.py +++ b/testing/web-platform/tests/xhr/resources/auth2/auth.py @@ -1,12 +1,14 @@ -import imp import os from wptserve.utils import isomorphic_decode +from tools.wpt.utils import load_source + here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__))) + def main(request, response): - auth = imp.load_source(u"", os.path.join(here, + auth = load_source(u"", os.path.join(here, u"..", u"authentication.py")) return auth.main(request, response) diff --git a/testing/web-platform/tests/xhr/resources/auth2/corsenabled.py b/testing/web-platform/tests/xhr/resources/auth2/corsenabled.py index bec6687dbe..7b9d3b65ab 100644 --- a/testing/web-platform/tests/xhr/resources/auth2/corsenabled.py +++ b/testing/web-platform/tests/xhr/resources/auth2/corsenabled.py @@ -1,8 +1,9 @@ -import imp import os from wptserve.utils import isomorphic_decode +from tools.wpt.utils import load_source + here = os.path.dirname(isomorphic_decode(__file__)) def main(request, response): @@ -11,7 +12,7 @@ def main(request, response): response.headers.set(b'Access-Control-Allow-Methods', b'GET') response.headers.set(b'Access-Control-Allow-Headers', b'authorization, x-user, x-pass') response.headers.set(b'Access-Control-Expose-Headers', b'x-challenge, xhr-user, ses-user') - auth = imp.load_source(u"", os.path.abspath(os.path.join(here, os.pardir, u"authentication.py"))) + auth = load_source(u"", os.path.abspath(os.path.join(here, os.pardir, u"authentication.py"))) if request.method == u"OPTIONS": return b"" else: diff --git a/testing/web-platform/tests/xhr/resources/auth3/auth.py b/testing/web-platform/tests/xhr/resources/auth3/auth.py index db4f7bc4c9..3797aaa52e 100644 --- a/testing/web-platform/tests/xhr/resources/auth3/auth.py +++ b/testing/web-platform/tests/xhr/resources/auth3/auth.py @@ -1,12 +1,13 @@ -import imp import os from wptserve.utils import isomorphic_decode +from tools.wpt.utils import load_source + here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__))) def main(request, response): - auth = imp.load_source(u"", os.path.join(here, + auth = load_source(u"", os.path.join(here, u"..", u"authentication.py")) return auth.main(request, response) diff --git a/testing/web-platform/tests/xhr/resources/auth4/auth.py b/testing/web-platform/tests/xhr/resources/auth4/auth.py index db4f7bc4c9..3797aaa52e 100644 --- a/testing/web-platform/tests/xhr/resources/auth4/auth.py +++ b/testing/web-platform/tests/xhr/resources/auth4/auth.py @@ -1,12 +1,13 @@ -import imp import os from wptserve.utils import isomorphic_decode +from tools.wpt.utils import load_source + here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__))) def main(request, response): - auth = imp.load_source(u"", os.path.join(here, + auth = load_source(u"", os.path.join(here, u"..", u"authentication.py")) return auth.main(request, response) diff --git a/testing/web-platform/tests/xhr/resources/auth7/corsenabled.py b/testing/web-platform/tests/xhr/resources/auth7/corsenabled.py index 7a060627b7..c82ba4e6bc 100644 --- a/testing/web-platform/tests/xhr/resources/auth7/corsenabled.py +++ b/testing/web-platform/tests/xhr/resources/auth7/corsenabled.py @@ -1,8 +1,9 @@ -import imp import os from wptserve.utils import isomorphic_decode +from tools.wpt.utils import load_source + here = os.path.dirname(isomorphic_decode(__file__)) def main(request, response): @@ -11,7 +12,7 @@ def main(request, response): response.headers.set(b'Access-Control-Allow-Methods', b'GET') response.headers.set(b'Access-Control-Allow-Headers', b'authorization, x-user, x-pass') response.headers.set(b'Access-Control-Expose-Headers', b'x-challenge, xhr-user, ses-user') - auth = imp.load_source(u"", os.path.join(here, + auth = load_source(u"", os.path.join(here, os.pardir, u"authentication.py")) if request.method == u"OPTIONS": diff --git a/testing/web-platform/tests/xhr/resources/auth8/corsenabled-no-authorize.py b/testing/web-platform/tests/xhr/resources/auth8/corsenabled-no-authorize.py index af8e7c4c17..4fdf99e265 100644 --- a/testing/web-platform/tests/xhr/resources/auth8/corsenabled-no-authorize.py +++ b/testing/web-platform/tests/xhr/resources/auth8/corsenabled-no-authorize.py @@ -1,8 +1,9 @@ -import imp import os from wptserve.utils import isomorphic_decode +from tools.wpt.utils import load_source + here = os.path.dirname(isomorphic_decode(__file__)) def main(request, response): @@ -11,7 +12,7 @@ def main(request, response): response.headers.set(b'Access-Control-Allow-Methods', b'GET') response.headers.set(b'Access-Control-Allow-Headers', b'x-user, x-pass') response.headers.set(b'Access-Control-Expose-Headers', b'x-challenge, xhr-user, ses-user') - auth = imp.load_source(u"", os.path.join(here, + auth = load_source(u"", os.path.join(here, os.pardir, u"authentication.py")) if request.method == u"OPTIONS": diff --git a/testing/web-platform/tests/xhr/resources/auth9/auth.py b/testing/web-platform/tests/xhr/resources/auth9/auth.py index db4f7bc4c9..3797aaa52e 100644 --- a/testing/web-platform/tests/xhr/resources/auth9/auth.py +++ b/testing/web-platform/tests/xhr/resources/auth9/auth.py @@ -1,12 +1,13 @@ -import imp import os from wptserve.utils import isomorphic_decode +from tools.wpt.utils import load_source + here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__))) def main(request, response): - auth = imp.load_source(u"", os.path.join(here, + auth = load_source(u"", os.path.join(here, u"..", u"authentication.py")) return auth.main(request, response) diff --git a/testing/web-platform/update/__init__.py b/testing/web-platform/update/__init__.py index 47c6d36d95..66bb6f2ab6 100644 --- a/testing/web-platform/update/__init__.py +++ b/testing/web-platform/update/__init__.py @@ -4,15 +4,15 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -import imp import os import sys +from mozfile import load_source from mozlog import structuredlog here = os.path.split(__file__)[0] -imp.load_source( +load_source( "localpaths", os.path.join(here, os.pardir, "tests", "tools", "localpaths.py") ) |