Use importlib to take place of imp module
The imp module is deprecated[1] since version 3.4, use importlib to instead [1]: https://docs.python.org/3/library/imp.html#imp.reload Change-Id: I7da97be7403617e1460ae179f7e62dcfa47cdf09
This commit is contained in:
parent
da91dadfc2
commit
b27e70a7da
|
@ -12,7 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import imp
|
||||
import importlib
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
|
@ -24,7 +24,7 @@ from ec2api.tests.unit import base
|
|||
class ClientsTestCase(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
imp.reload(clients)
|
||||
importlib.reload(clients)
|
||||
super(ClientsTestCase, self).setUp()
|
||||
|
||||
@mock.patch.object(clients, '_get_nova_api_version', return_value='2.3')
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import imp
|
||||
import importlib
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
@ -36,7 +36,7 @@ class ContextTestCase(test_base.BaseTestCase):
|
|||
clients._admin_session = None
|
||||
conf.config(auth_type='fake', group=GROUP_AUTHTOKEN)
|
||||
|
||||
imp.reload(ec2_context)
|
||||
importlib.reload(ec2_context)
|
||||
# NOTE(ft): initialize a regular context to populate oslo_context's
|
||||
# local storage to prevent admin context to populate it.
|
||||
# Used to implicitly validate overwrite=False argument of the call
|
||||
|
|
Loading…
Reference in New Issue