examples, tools: Fix Python3 deprecation warning for the imp module

This commit is contained in:
Roland Dobai
2018-12-14 17:37:43 +01:00
parent 65142bc59e
commit 4ca2b149e5
7 changed files with 37 additions and 24 deletions
+2 -4
View File
@@ -17,8 +17,7 @@ import os
import fnmatch
import types
import copy
# TODO: add a function to use suitable import lib for python2 and python3
import imp
from Utility import load_source
class Search(object):
@@ -31,8 +30,7 @@ class Search(object):
print("Try to get cases from: " + file_name)
test_functions = []
try:
# TODO: add a function to use suitable import lib for python2 and python3
mod = imp.load_source(str(hash(file_name)), file_name)
mod = load_source(str(hash(file_name)), file_name)
for func in [mod.__getattribute__(x) for x in dir(mod)
if isinstance(mod.__getattribute__(x), types.FunctionType)]:
try: