diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-17 12:02:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-17 13:23:02 +0200 |
commit | 069f0eb13f7d26ce4b854160bbb9592c25609b38 (patch) | |
tree | f890dfa75cdccf83dbd0f3fa74910686a6660049 | |
parent | ef3c759357cb3dbe4fee46afd24105a1c2e24126 (diff) |
use exec_module on newer Python (>3.3) to avoid DeprecationWarning
Change-Id: I7d0624f63e5d123d5013c14aa0f23355cd42dd0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134466
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | uitest/test_main.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/uitest/test_main.py b/uitest/test_main.py index f69e7523530a..2cefafb074ed 100644 --- a/uitest/test_main.py +++ b/uitest/test_main.py @@ -11,6 +11,7 @@ import os import unittest import importlib import importlib.machinery +import types from uitest.framework import UITestCase @@ -76,7 +77,12 @@ def add_tests_for_file(test_file, test_suite): module_name = os.path.splitext(os.path.split(test_file)[1])[0] loader = importlib.machinery.SourceFileLoader(module_name, test_file) - mod = loader.load_module() + # exec_module was only introduced in 3.4 + if sys.version_info[1] < 4: + mod = loader.load_module() + else: + mod = types.ModuleType(loader.name) + loader.exec_module(mod) classes = get_test_case_classes_of_module(mod) global test_name_limit_found for c in classes: |