summaryrefslogtreecommitdiffstats
path: root/testing/mochitest/mach_commands.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:27 +0000
commitf3bcaf9f88aad2c423ebcd61121562f9834187d4 (patch)
treef22238c29b57707b645a350940e3e9bdf3ce1f5d /testing/mochitest/mach_commands.py
parentAdding debian version 115.7.0esr-1~deb12u1. (diff)
downloadfirefox-esr-f3bcaf9f88aad2c423ebcd61121562f9834187d4.tar.xz
firefox-esr-f3bcaf9f88aad2c423ebcd61121562f9834187d4.zip
Merging upstream version 115.8.0esr.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/mochitest/mach_commands.py')
-rw-r--r--testing/mochitest/mach_commands.py22
1 files changed, 6 insertions, 16 deletions
diff --git a/testing/mochitest/mach_commands.py b/testing/mochitest/mach_commands.py
index c1f0c0cfa9..74730a98bd 100644
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -14,6 +14,7 @@ import six
from mach.decorators import Command, CommandArgument
from mozbuild.base import MachCommandConditions as conditions
from mozbuild.base import MozbuildObject
+from mozfile import load_source
here = os.path.abspath(os.path.dirname(__file__))
@@ -90,11 +91,8 @@ class MochitestRunner(MozbuildObject):
"""Runs a mochitest."""
# runtests.py is ambiguous, so we load the file/module manually.
if "mochitest" not in sys.modules:
- import imp
-
path = os.path.join(self.mochitest_dir, "runtests.py")
- with open(path, "r") as fh:
- imp.load_module("mochitest", fh, path, (".py", "r", imp.PY_SOURCE))
+ load_source("mochitest", path)
import mochitest
@@ -145,11 +143,9 @@ class MochitestRunner(MozbuildObject):
if host_ret != 0:
return host_ret
- import imp
-
path = os.path.join(self.mochitest_dir, "runtestsremote.py")
- with open(path, "r") as fh:
- imp.load_module("runtestsremote", fh, path, (".py", "r", imp.PY_SOURCE))
+ load_source("runtestsremote", path)
+
import runtestsremote
options = Namespace(**kwargs)
@@ -195,14 +191,11 @@ def setup_argument_parser():
with warnings.catch_warnings():
warnings.simplefilter("ignore")
- import imp
-
path = os.path.join(build_obj.topobjdir, mochitest_dir, "runtests.py")
if not os.path.exists(path):
path = os.path.join(here, "runtests.py")
- with open(path, "r") as fh:
- imp.load_module("mochitest", fh, path, (".py", "r", imp.PY_SOURCE))
+ load_source("mochitest", path)
from mochitest_options import MochitestArgumentParser
@@ -237,14 +230,11 @@ def setup_junit_argument_parser():
warnings.simplefilter("ignore")
# runtests.py contains MochitestDesktop, required by runjunit
- import imp
-
path = os.path.join(build_obj.topobjdir, mochitest_dir, "runtests.py")
if not os.path.exists(path):
path = os.path.join(here, "runtests.py")
- with open(path, "r") as fh:
- imp.load_module("mochitest", fh, path, (".py", "r", imp.PY_SOURCE))
+ load_source("mochitest", path)
import runjunit
from mozrunner.devices.android_device import (