mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
validate:launcher: Avoid clashes when importing testsuite
This introduce an hard dependency on python >= 3.5, same as meson
This commit is contained in:
parent
6b907ba036
commit
80de180cc7
1 changed files with 5 additions and 1 deletions
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
""" Class representing tests and test managers. """
|
""" Class representing tests and test managers. """
|
||||||
|
|
||||||
|
import importlib.util
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -1636,7 +1637,10 @@ class _TestsLauncher(Loggable):
|
||||||
for testsuite in testsuites:
|
for testsuite in testsuites:
|
||||||
try:
|
try:
|
||||||
sys.path.insert(0, os.path.dirname(testsuite))
|
sys.path.insert(0, os.path.dirname(testsuite))
|
||||||
return (__import__(os.path.basename(testsuite).replace(".py", "")), None)
|
spec = importlib.util.spec_from_file_location(os.path.basename(testsuite).replace(".py", ""), testsuite)
|
||||||
|
module = importlib.util.module_from_spec(spec)
|
||||||
|
spec.loader.exec_module(module)
|
||||||
|
return (module, None)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exceptions.append("Could not load %s: %s" % (testsuite, e))
|
exceptions.append("Could not load %s: %s" % (testsuite, e))
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue