Skip to content

Commit

Permalink
Replace imp by importlib in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Apr 4, 2023
1 parent 6b94a31 commit 97b8a76
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/python/Integration_t/RequestLifeCycleBase_t.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from nose.plugins.attrib import attr
import time
import os
import imp
import importlib
from functools import wraps

# decorator around tests - record errors
Expand Down Expand Up @@ -70,8 +70,8 @@ def _configCacheId(self, label):
configCache.addConfig(os.path.join(configDir, label + '.py'))
configCache.setLabel(label)
configCache.setDescription(label)
modPath = imp.find_module(label, [configDir])
loadedConfig = imp.load_module(label, modPath[0], modPath[1], modPath[2])
modSpecs = importlib.machinery.PathFinder().find_spec(label, [configDir])
loadedConfig = modSpecs.loader.load_module()
configCache.setPSetTweaks(makeTweak(loadedConfig.process).jsondictionary())
configCache.save()
return configCache.getIDFromLabel(label)
Expand Down
1 change: 0 additions & 1 deletion test/python/WMCore_t/Services_t/PyCurlRESTModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import unittest
import threading
import cherrypy
import imp
import os
import uuid
import tempfile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from builtins import zip

import imp
import unittest
import os
import sys
Expand Down

0 comments on commit 97b8a76

Please sign in to comment.