uitest/test_main.py |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 92116110bbbf1df1c537ae0d3e93ccf30c3bb0e6
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue May 17 12:02:48 2022 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Nov 8 10:08:48 2022 +0100

    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.gran...@collabora.co.uk>
    (cherry picked from commit 069f0eb13f7d26ce4b854160bbb9592c25609b38)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142309
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/uitest/test_main.py b/uitest/test_main.py
index 157d1f424e15..ae3367ddae2c 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
 
 import uitest.config
 
@@ -75,7 +76,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:

Reply via email to