forked from ungleich-public/cdist
Merge branch 'imp-deprecation' into 'master'
Deal with deprecation of imp module. See merge request ungleich-public/cdist!963
This commit is contained in:
commit
226f665fb5
1 changed files with 4 additions and 3 deletions
|
@ -20,7 +20,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
import imp
|
import importlib
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
@ -37,8 +37,9 @@ for possible_test in os.listdir(base_dir):
|
||||||
|
|
||||||
suites = []
|
suites = []
|
||||||
for test_module in test_modules:
|
for test_module in test_modules:
|
||||||
module_parameters = imp.find_module(test_module, [base_dir])
|
module_spec = importlib.util.find_spec("cdist.test.{}".format(test_module))
|
||||||
module = imp.load_module("cdist.test." + test_module, *module_parameters)
|
module = importlib.util.module_from_spec(module_spec)
|
||||||
|
module_spec.loader.exec_module(module)
|
||||||
|
|
||||||
suite = unittest.defaultTestLoader.loadTestsFromModule(module)
|
suite = unittest.defaultTestLoader.loadTestsFromModule(module)
|
||||||
# print("Got suite: " + suite.__str__())
|
# print("Got suite: " + suite.__str__())
|
||||||
|
|
Loading…
Reference in a new issue