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
This commit is contained in:
houming-wang 2015-12-30 02:06:35 -05:00
parent ffe45ebb42
commit a1ca88ce78
2 changed files with 4 additions and 1 deletions

View File

@ -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

View File

@ -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 \