From f62241675f3b6a881f54ad645158e34b9089bb8e Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 20 Aug 2015 10:19:03 -0700 Subject: [PATCH] py3: replace reload with six.moves.reload_module Get the reload() function from six.moves.reload_module(). Partial-Implements: blueprint porting-python3 Change-Id: I063f83ac7e51c47d8c0172f0de4ae944fb11aa61 --- horizon/test/tests/base.py | 7 ++++--- openstack_dashboard/test/helpers.py | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/horizon/test/tests/base.py b/horizon/test/tests/base.py index f5fa5c02e6..4d3abf52f5 100644 --- a/horizon/test/tests/base.py +++ b/horizon/test/tests/base.py @@ -22,6 +22,7 @@ from django.contrib.auth.models import User # noqa from django.core.exceptions import ImproperlyConfigured # noqa from django.core import urlresolvers from django.utils.importlib import import_module # noqa +from six import moves import horizon from horizon import base @@ -101,7 +102,7 @@ class BaseHorizonTests(test.TestCase): del base.Horizon base.Horizon = base.HorizonSite() # Reload the convenience references to Horizon stored in __init__ - reload(import_module("horizon")) + moves.reload_module(import_module("horizon")) # Re-register our original dashboards and panels. # This is necessary because autodiscovery only works on the first # import, and calling reload introduces innumerable additional @@ -120,7 +121,7 @@ class BaseHorizonTests(test.TestCase): only for testing and should never be used on a live site. """ urlresolvers.clear_url_caches() - reload(import_module(settings.ROOT_URLCONF)) + moves.reload_module(import_module(settings.ROOT_URLCONF)) base.Horizon._urls() @@ -490,7 +491,7 @@ class RbacHorizonTests(test.TestCase): del base.Horizon base.Horizon = base.HorizonSite() # Reload the convenience references to Horizon stored in __init__ - reload(import_module("horizon")) + moves.reload_module(import_module("horizon")) # Reset Cats and Dogs default_panel to default values Cats.default_panel = 'kittens' diff --git a/openstack_dashboard/test/helpers.py b/openstack_dashboard/test/helpers.py index 6bea0214a1..a8d0a79058 100644 --- a/openstack_dashboard/test/helpers.py +++ b/openstack_dashboard/test/helpers.py @@ -43,6 +43,7 @@ from neutronclient.v2_0 import client as neutron_client from novaclient.v2 import client as nova_client from openstack_auth import user from openstack_auth import utils +from six import moves from swiftclient import client as swift_client from horizon import base @@ -530,7 +531,7 @@ class PluginTestCase(TestCase): del base.Horizon base.Horizon = base.HorizonSite() # Reload the convenience references to Horizon stored in __init__ - reload(import_module("horizon")) + moves.reload_module(import_module("horizon")) # Re-register our original dashboards and panels. # This is necessary because autodiscovery only works on the first # import, and calling reload introduces innumerable additional @@ -550,7 +551,7 @@ class PluginTestCase(TestCase): only for testing and should never be used on a live site. """ urlresolvers.clear_url_caches() - reload(import_module(settings.ROOT_URLCONF)) + moves.reload_module(import_module(settings.ROOT_URLCONF)) base.Horizon._urls()