diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 15:11:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 15:11:26 +0000 |
commit | fcea19dfd2c426bac0456da850e7c12258e4b9eb (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/marionette | |
parent | Adding upstream version 115.7.0esr. (diff) | |
download | firefox-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/marionette')
-rw-r--r-- | testing/marionette/harness/marionette_harness/marionette_test/testcases.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/testing/marionette/harness/marionette_harness/marionette_test/testcases.py b/testing/marionette/harness/marionette_harness/marionette_test/testcases.py index 32c36967bb..84a6e09665 100644 --- a/testing/marionette/harness/marionette_harness/marionette_test/testcases.py +++ b/testing/marionette/harness/marionette_harness/marionette_test/testcases.py @@ -2,7 +2,7 @@ # 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 re import sys @@ -14,6 +14,7 @@ from unittest.case import SkipTest import six from marionette_driver.errors import TimeoutException, UnresponsiveInstanceException +from mozfile import load_source from mozlog import get_default_logger @@ -365,21 +366,20 @@ class MarionetteTestCase(CommonTestCase): testvars, **kwargs ): - # since we use imp.load_source to load test modules, if a module - # is loaded with the same name as another one the module would just be - # reloaded. + # since load_source caches modules, if a module is loaded with the same + # name as another one the module would just be reloaded. # - # We may end up by finding too many test in a module then since - # reload() only update the module dict (so old keys are still there!) - # see https://docs.python.org/2/library/functions.html#reload + # We may end up by finding too many test in a module then since reload() + # only update the module dict (so old keys are still there!) see + # https://docs.python.org/2/library/functions.html#reload # - # we get rid of that by removing the module from sys.modules, - # so we ensure that it will be fully loaded by the - # imp.load_source call. + # we get rid of that by removing the module from sys.modules, so we + # ensure that it will be fully loaded by the imp.load_source call. + if mod_name in sys.modules: del sys.modules[mod_name] - test_mod = imp.load_source(mod_name, filepath) + test_mod = load_source(mod_name, filepath) for name in dir(test_mod): obj = getattr(test_mod, name) |