From a1ca88ce78421e7253add8385c01b5fca8b63c8e Mon Sep 17 00:00:00 2001 From: houming-wang Date: Wed, 30 Dec 2015 02:06:35 -0500 Subject: [PATCH] Use six.moves.reload_module instead of builtin reload Builtin function 'reload' in Python 2 has been moved to standard library module in Python 3 [1]. To make code compatible, we should replace reload(mod) with six.moves.reload_module(mod) [1] http://python3porting.com/stdlib.html#moved-builtins Change-Id: Ice919c8725ec00f25a5aa0440d7ee6bc9065f653 Patially-Implements: blueprint python3 --- keystone/tests/unit/test_token_provider.py | 4 +++- tox.ini | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/keystone/tests/unit/test_token_provider.py b/keystone/tests/unit/test_token_provider.py index b79be2e520..5c71363bda 100644 --- a/keystone/tests/unit/test_token_provider.py +++ b/keystone/tests/unit/test_token_provider.py @@ -16,6 +16,7 @@ import datetime from oslo_config import cfg from oslo_utils import timeutils +from six.moves import reload_module from keystone.common import dependency from keystone.common import utils @@ -809,7 +810,8 @@ class PKIProviderTests(object): self.cms.subprocess = self.target_subprocess self.environment.subprocess = self.target_subprocess - reload(pki) # force module reload so the imports get re-evaluated + # force module reload so the imports get re-evaluated + reload_module(pki) def test_get_token_id_error_handling(self): # cause command-line failure diff --git a/tox.ini b/tox.ini index 0976510bc3..8bfe2f6183 100644 --- a/tox.ini +++ b/tox.ini @@ -63,6 +63,7 @@ commands = keystone/tests/unit/tests/test_core.py \ keystone/tests/unit/tests/test_utils.py \ keystone/tests/unit/test_token_bind.py \ + keystone/tests/unit/test_token_provider.py \ keystone/tests/unit/test_url_middleware.py \ keystone/tests/unit/test_v2_controller.py \ keystone/tests/unit/test_v3_controller.py \