From fdd7a355bf053217d25b8d2189e37069c1304283 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Mon, 29 Jul 2013 15:50:58 +0200 Subject: [PATCH] Deprecated django.utils.importlib This was a shim for pre-Python 2.7 support. --- django/conf/__init__.py | 2 +- django/conf/urls/__init__.py | 3 ++- django/contrib/admin/__init__.py | 2 +- django/contrib/admindocs/views.py | 2 +- django/contrib/auth/hashers.py | 2 +- django/contrib/comments/__init__.py | 2 +- django/contrib/formtools/tests/wizard/storage.py | 2 +- django/contrib/formtools/tests/wizard/test_forms.py | 3 ++- django/contrib/gis/geometry/backend/__init__.py | 5 +++-- .../sessions/management/commands/clearsessions.py | 3 ++- django/contrib/sessions/middleware.py | 2 +- django/contrib/staticfiles/storage.py | 2 +- django/core/cache/__init__.py | 2 +- django/core/management/__init__.py | 6 +++--- django/core/management/commands/flush.py | 2 +- django/core/management/commands/startapp.py | 3 ++- django/core/management/commands/startproject.py | 3 ++- django/core/management/commands/syncdb.py | 2 +- django/core/serializers/__init__.py | 3 ++- django/core/servers/fastcgi.py | 2 +- django/core/urlresolvers.py | 2 +- django/db/backends/__init__.py | 2 +- django/db/models/loading.py | 12 ++++++------ django/db/utils.py | 4 ++-- django/template/base.py | 2 +- django/template/loaders/app_directories.py | 2 +- django/test/client.py | 2 +- django/test/simple.py | 2 +- django/utils/formats.py | 4 ++-- django/utils/importlib.py | 5 +++++ django/utils/module_loading.py | 2 +- django/utils/translation/trans_real.py | 2 +- django/views/i18n.py | 2 +- docs/internals/deprecation.txt | 2 ++ docs/releases/1.7.txt | 9 +++++---- tests/i18n/tests.py | 2 +- tests/test_runner/tests.py | 2 +- tests/utils_tests/test_module_loading.py | 2 +- 38 files changed, 64 insertions(+), 49 deletions(-) diff --git a/django/conf/__init__.py b/django/conf/__init__.py index c4b9634d83..56d9ab21c9 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -6,6 +6,7 @@ variable, and then from django.conf.global_settings; see the global settings fil a list of all possible variables. """ +import importlib import logging import os import sys @@ -15,7 +16,6 @@ import warnings from django.conf import global_settings from django.core.exceptions import ImproperlyConfigured from django.utils.functional import LazyObject, empty -from django.utils import importlib from django.utils.module_loading import import_by_path from django.utils import six diff --git a/django/conf/urls/__init__.py b/django/conf/urls/__init__.py index c0340c0543..f4a129a9e0 100644 --- a/django/conf/urls/__init__.py +++ b/django/conf/urls/__init__.py @@ -1,7 +1,8 @@ +from importlib import import_module + from django.core.urlresolvers import (RegexURLPattern, RegexURLResolver, LocaleRegexURLResolver) from django.core.exceptions import ImproperlyConfigured -from django.utils.importlib import import_module from django.utils import six diff --git a/django/contrib/admin/__init__.py b/django/contrib/admin/__init__.py index 1084784003..ef2e87407a 100644 --- a/django/contrib/admin/__init__.py +++ b/django/contrib/admin/__init__.py @@ -17,8 +17,8 @@ def autodiscover(): """ import copy + from importlib import import_module from django.conf import settings - from django.utils.importlib import import_module from django.utils.module_loading import module_has_submodule for app in settings.INSTALLED_APPS: diff --git a/django/contrib/admindocs/views.py b/django/contrib/admindocs/views.py index b3faf06e25..ac46132687 100644 --- a/django/contrib/admindocs/views.py +++ b/django/contrib/admindocs/views.py @@ -1,3 +1,4 @@ +from importlib import import_module import inspect import os import re @@ -13,7 +14,6 @@ from django.http import Http404 from django.core import urlresolvers from django.contrib.admindocs import utils from django.contrib.sites.models import Site -from django.utils.importlib import import_module from django.utils._os import upath from django.utils import six from django.utils.translation import ugettext as _ diff --git a/django/contrib/auth/hashers.py b/django/contrib/auth/hashers.py index 7656b50437..45ebc0f980 100644 --- a/django/contrib/auth/hashers.py +++ b/django/contrib/auth/hashers.py @@ -3,11 +3,11 @@ from __future__ import unicode_literals import base64 import binascii import hashlib +import importlib from django.dispatch import receiver from django.conf import settings from django.test.signals import setting_changed -from django.utils import importlib from django.utils.datastructures import SortedDict from django.utils.encoding import force_bytes, force_str, force_text from django.core.exceptions import ImproperlyConfigured diff --git a/django/contrib/comments/__init__.py b/django/contrib/comments/__init__.py index 0b3fcebc51..56ed32bafe 100644 --- a/django/contrib/comments/__init__.py +++ b/django/contrib/comments/__init__.py @@ -1,10 +1,10 @@ +from importlib import import_module import warnings from django.conf import settings from django.core import urlresolvers from django.core.exceptions import ImproperlyConfigured from django.contrib.comments.models import Comment from django.contrib.comments.forms import CommentForm -from django.utils.importlib import import_module warnings.warn("django.contrib.comments is deprecated and will be removed before Django 1.8.", DeprecationWarning) diff --git a/django/contrib/formtools/tests/wizard/storage.py b/django/contrib/formtools/tests/wizard/storage.py index 17968dfcda..c54ed9a058 100644 --- a/django/contrib/formtools/tests/wizard/storage.py +++ b/django/contrib/formtools/tests/wizard/storage.py @@ -1,8 +1,8 @@ from datetime import datetime +from importlib import import_module from django.http import HttpRequest from django.conf import settings -from django.utils.importlib import import_module from django.contrib.auth.models import User diff --git a/django/contrib/formtools/tests/wizard/test_forms.py b/django/contrib/formtools/tests/wizard/test_forms.py index 21917822a7..ba3fbfdd48 100644 --- a/django/contrib/formtools/tests/wizard/test_forms.py +++ b/django/contrib/formtools/tests/wizard/test_forms.py @@ -1,11 +1,12 @@ from __future__ import unicode_literals +from importlib import import_module + from django import forms, http from django.conf import settings from django.db import models from django.test import TestCase from django.template.response import TemplateResponse -from django.utils.importlib import import_module from django.contrib.auth.models import User diff --git a/django/contrib/gis/geometry/backend/__init__.py b/django/contrib/gis/geometry/backend/__init__.py index d9f30bb256..5830e482f9 100644 --- a/django/contrib/gis/geometry/backend/__init__.py +++ b/django/contrib/gis/geometry/backend/__init__.py @@ -1,11 +1,12 @@ +from importlib import import_module + from django.conf import settings from django.core.exceptions import ImproperlyConfigured -from django.utils.importlib import import_module geom_backend = getattr(settings, 'GEOMETRY_BACKEND', 'geos') try: - module = import_module('.%s' % geom_backend, 'django.contrib.gis.geometry.backend') + module = import_module('django.contrib.gis.geometry.backend.%s' % geom_backend) except ImportError: try: module = import_module(geom_backend) diff --git a/django/contrib/sessions/management/commands/clearsessions.py b/django/contrib/sessions/management/commands/clearsessions.py index 8eb23dfee0..fa0dad31c3 100644 --- a/django/contrib/sessions/management/commands/clearsessions.py +++ b/django/contrib/sessions/management/commands/clearsessions.py @@ -1,6 +1,7 @@ +from importlib import import_module + from django.conf import settings from django.core.management.base import NoArgsCommand -from django.utils.importlib import import_module class Command(NoArgsCommand): diff --git a/django/contrib/sessions/middleware.py b/django/contrib/sessions/middleware.py index 8bc2d37dd3..e8ebf3d5f9 100644 --- a/django/contrib/sessions/middleware.py +++ b/django/contrib/sessions/middleware.py @@ -1,9 +1,9 @@ +from importlib import import_module import time from django.conf import settings from django.utils.cache import patch_vary_headers from django.utils.http import cookie_date -from django.utils.importlib import import_module class SessionMiddleware(object): def __init__(self): diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py index cd4ca516d5..f6d0a37a11 100644 --- a/django/contrib/staticfiles/storage.py +++ b/django/contrib/staticfiles/storage.py @@ -1,5 +1,6 @@ from __future__ import unicode_literals import hashlib +from importlib import import_module import os import posixpath import re @@ -18,7 +19,6 @@ from django.core.files.storage import FileSystemStorage, get_storage_class from django.utils.datastructures import SortedDict from django.utils.encoding import force_bytes, force_text from django.utils.functional import LazyObject -from django.utils.importlib import import_module from django.utils._os import upath from django.contrib.staticfiles.utils import check_settings, matches_patterns diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py index 1242372dcf..e1d2eb455a 100644 --- a/django/core/cache/__init__.py +++ b/django/core/cache/__init__.py @@ -14,6 +14,7 @@ cache class. See docs/topics/cache.txt for information on the public API. """ +import importlib try: from urllib.parse import parse_qsl except ImportError: # Python 2 @@ -24,7 +25,6 @@ from django.core import signals from django.core.cache.backends.base import ( InvalidCacheBackendError, CacheKeyWarning, BaseCache) from django.core.exceptions import ImproperlyConfigured -from django.utils import importlib from django.utils.module_loading import import_by_path diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index 0ed8e0a786..2ac797ecfe 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -1,13 +1,13 @@ import collections +import imp +from importlib import import_module +from optparse import OptionParser, NO_DEFAULT import os import sys -from optparse import OptionParser, NO_DEFAULT -import imp from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand, CommandError, handle_default_options from django.core.management.color import color_style -from django.utils.importlib import import_module from django.utils import six # For backwards compatibility: get_version() used to be in this module. diff --git a/django/core/management/commands/flush.py b/django/core/management/commands/flush.py index 95dd634d08..e5a7253e73 100644 --- a/django/core/management/commands/flush.py +++ b/django/core/management/commands/flush.py @@ -1,4 +1,5 @@ import sys +from importlib import import_module from optparse import make_option from django.conf import settings @@ -7,7 +8,6 @@ from django.core.management import call_command from django.core.management.base import NoArgsCommand, CommandError from django.core.management.color import no_style from django.core.management.sql import sql_flush, emit_post_sync_signal -from django.utils.importlib import import_module from django.utils.six.moves import input from django.utils import six diff --git a/django/core/management/commands/startapp.py b/django/core/management/commands/startapp.py index 692ad09a43..77e884ca5a 100644 --- a/django/core/management/commands/startapp.py +++ b/django/core/management/commands/startapp.py @@ -1,6 +1,7 @@ +from importlib import import_module + from django.core.management.base import CommandError from django.core.management.templates import TemplateCommand -from django.utils.importlib import import_module class Command(TemplateCommand): diff --git a/django/core/management/commands/startproject.py b/django/core/management/commands/startproject.py index b143e6c380..b7dcbcaba5 100644 --- a/django/core/management/commands/startproject.py +++ b/django/core/management/commands/startproject.py @@ -1,7 +1,8 @@ +from importlib import import_module + from django.core.management.base import CommandError from django.core.management.templates import TemplateCommand from django.utils.crypto import get_random_string -from django.utils.importlib import import_module class Command(TemplateCommand): diff --git a/django/core/management/commands/syncdb.py b/django/core/management/commands/syncdb.py index 3e73d24a04..7c8d8b5d8f 100644 --- a/django/core/management/commands/syncdb.py +++ b/django/core/management/commands/syncdb.py @@ -1,3 +1,4 @@ +from importlib import import_module from optparse import make_option import itertools import traceback @@ -9,7 +10,6 @@ from django.core.management.color import no_style from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal, emit_pre_sync_signal from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS from django.utils.datastructures import SortedDict -from django.utils.importlib import import_module class Command(NoArgsCommand): diff --git a/django/core/serializers/__init__.py b/django/core/serializers/__init__.py index c48050415d..dc3d139d3b 100644 --- a/django/core/serializers/__init__.py +++ b/django/core/serializers/__init__.py @@ -16,8 +16,9 @@ To add your own serializers, use the SERIALIZATION_MODULES setting:: """ +import importlib + from django.conf import settings -from django.utils import importlib from django.utils import six from django.core.serializers.base import SerializerDoesNotExist diff --git a/django/core/servers/fastcgi.py b/django/core/servers/fastcgi.py index 2ae1fa5ae3..a612142969 100644 --- a/django/core/servers/fastcgi.py +++ b/django/core/servers/fastcgi.py @@ -12,9 +12,9 @@ Run with the extra option "help" for a list of additional options you can pass to this server. """ +import importlib import os import sys -from django.utils import importlib __version__ = "0.1" __all__ = ["runfastcgi"] diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py index b7017e47b9..9e086a453a 100644 --- a/django/core/urlresolvers.py +++ b/django/core/urlresolvers.py @@ -8,6 +8,7 @@ a string) and returns a tuple in this format: """ from __future__ import unicode_literals +from importlib import import_module import re from threading import local @@ -17,7 +18,6 @@ from django.utils.datastructures import MultiValueDict from django.utils.encoding import force_str, force_text, iri_to_uri from django.utils.functional import memoize, lazy from django.utils.http import urlquote -from django.utils.importlib import import_module from django.utils.module_loading import module_has_submodule from django.utils.regex_helper import normalize from django.utils import six diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index a553351c5c..946c650c34 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -9,6 +9,7 @@ except ImportError: from django.utils.six.moves import _dummy_thread as thread from collections import namedtuple from contextlib import contextmanager +from importlib import import_module from django.conf import settings from django.db import DEFAULT_DB_ALIAS @@ -17,7 +18,6 @@ from django.db.backends import util from django.db.transaction import TransactionManagementError from django.db.utils import DatabaseErrorWrapper from django.utils.functional import cached_property -from django.utils.importlib import import_module from django.utils import six from django.utils import timezone diff --git a/django/db/models/loading.py b/django/db/models/loading.py index 9a0cadaf37..83682035d2 100644 --- a/django/db/models/loading.py +++ b/django/db/models/loading.py @@ -1,17 +1,17 @@ "Utilities for loading models and the modules that contain them." +import imp +from importlib import import_module +import os +import sys + from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils.datastructures import SortedDict -from django.utils.importlib import import_module from django.utils.module_loading import module_has_submodule from django.utils._os import upath from django.utils import six -import imp -import sys -import os - __all__ = ('get_apps', 'get_app', 'get_models', 'get_model', 'register_models', 'load_app', 'app_cache_ready') @@ -100,7 +100,7 @@ class AppCache(object): self.nesting_level += 1 app_module = import_module(app_name) try: - models = import_module('.' + MODELS_MODULE_NAME, app_name) + models = import_module('%s.%s' % (app_name, MODELS_MODULE_NAME)) except ImportError: self.nesting_level -= 1 # If the app doesn't have a models module, we can just ignore the diff --git a/django/db/utils.py b/django/db/utils.py index 36b89d9acf..a1a2c0b564 100644 --- a/django/db/utils.py +++ b/django/db/utils.py @@ -1,4 +1,5 @@ from functools import wraps +from importlib import import_module import os import pkgutil from threading import local @@ -7,7 +8,6 @@ import warnings from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils.functional import cached_property -from django.utils.importlib import import_module from django.utils.module_loading import import_by_path from django.utils._os import upath from django.utils import six @@ -104,7 +104,7 @@ class DatabaseErrorWrapper(object): def load_backend(backend_name): # Look for a fully qualified database backend name try: - return import_module('.base', backend_name) + return import_module('%s.base' % backend_name) except ImportError as e_user: # The database backend wasn't found. Display a helpful error message # listing all possible (built-in) database backends. diff --git a/django/template/base.py b/django/template/base.py index 364b428070..aa82d8911a 100644 --- a/django/template/base.py +++ b/django/template/base.py @@ -2,12 +2,12 @@ from __future__ import absolute_import, unicode_literals import re from functools import partial +from importlib import import_module from inspect import getargspec from django.conf import settings from django.template.context import (Context, RequestContext, ContextPopException) -from django.utils.importlib import import_module from django.utils.itercompat import is_iterable from django.utils.text import (smart_split, unescape_string_literal, get_text_list) diff --git a/django/template/loaders/app_directories.py b/django/template/loaders/app_directories.py index cea01558d9..b25f14aace 100644 --- a/django/template/loaders/app_directories.py +++ b/django/template/loaders/app_directories.py @@ -3,6 +3,7 @@ Wrapper for loading templates from "templates" directories in INSTALLED_APPS packages. """ +from importlib import import_module import os import sys @@ -11,7 +12,6 @@ from django.core.exceptions import ImproperlyConfigured from django.template.base import TemplateDoesNotExist from django.template.loader import BaseLoader from django.utils._os import safe_join -from django.utils.importlib import import_module from django.utils import six # At compile time, cache the directories to search. diff --git a/django/test/client.py b/django/test/client.py index 8dbd33ccf1..754d4d73f8 100644 --- a/django/test/client.py +++ b/django/test/client.py @@ -5,6 +5,7 @@ import os import re import mimetypes from copy import copy +from importlib import import_module from io import BytesIO try: from urllib.parse import unquote, urlparse, urlsplit @@ -25,7 +26,6 @@ from django.test import signals from django.utils.functional import curry from django.utils.encoding import force_bytes, force_str from django.utils.http import urlencode -from django.utils.importlib import import_module from django.utils.itercompat import is_iterable from django.utils import six from django.test.utils import ContextList diff --git a/django/test/simple.py b/django/test/simple.py index 019eff2421..b2ab1269b5 100644 --- a/django/test/simple.py +++ b/django/test/simple.py @@ -3,6 +3,7 @@ This module is pending deprecation as of Django 1.6 and will be removed in version 1.8. """ +from importlib import import_module import json import re import unittest as real_unittest @@ -15,7 +16,6 @@ from django.test.utils import compare_xml, strip_quotes # django.utils.unittest is deprecated, but so is django.test.simple, # and the latter will be removed before the former. from django.utils import unittest -from django.utils.importlib import import_module from django.utils.module_loading import module_has_submodule __all__ = ('DjangoTestSuiteRunner',) diff --git a/django/utils/formats.py b/django/utils/formats.py index cc66149026..6b89b40ecd 100644 --- a/django/utils/formats.py +++ b/django/utils/formats.py @@ -1,10 +1,10 @@ import decimal import datetime +from importlib import import_module import unicodedata from django.conf import settings from django.utils import dateformat, numberformat, datetime_safe -from django.utils.importlib import import_module from django.utils.encoding import force_str from django.utils.functional import lazy from django.utils.safestring import mark_safe @@ -54,7 +54,7 @@ def iter_format_modules(lang): for location in format_locations: for loc in locales: try: - yield import_module('.formats', location % loc) + yield import_module('%s.formats' % (location % loc)) except ImportError: pass diff --git a/django/utils/importlib.py b/django/utils/importlib.py index 703ba7f6d8..26e45589e3 100644 --- a/django/utils/importlib.py +++ b/django/utils/importlib.py @@ -1,6 +1,11 @@ # Taken from Python 2.7 with permission from/by the original author. +import warnings import sys +warnings.warn("django.utils.importlib will be removed in Django 1.9.", + PendingDeprecationWarning, stacklevel=2) + + def _resolve_name(name, package, level): """Return the absolute name of the module to be imported.""" if not hasattr(package, 'rindex'): diff --git a/django/utils/module_loading.py b/django/utils/module_loading.py index ede585e562..359982e6ba 100644 --- a/django/utils/module_loading.py +++ b/django/utils/module_loading.py @@ -1,10 +1,10 @@ import imp +from importlib import import_module import os import sys from django.core.exceptions import ImproperlyConfigured from django.utils import six -from django.utils.importlib import import_module def import_by_path(dotted_path, error_prefix=''): diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index 195badfc00..91a73f1e68 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -6,10 +6,10 @@ import os import re import sys import gettext as gettext_module +from importlib import import_module from threading import local import warnings -from django.utils.importlib import import_module from django.utils.datastructures import SortedDict from django.utils.encoding import force_str, force_text from django.utils.functional import memoize diff --git a/django/views/i18n.py b/django/views/i18n.py index 71ac005855..c913922999 100644 --- a/django/views/i18n.py +++ b/django/views/i18n.py @@ -1,3 +1,4 @@ +import importlib import json import os import gettext as gettext_module @@ -5,7 +6,6 @@ import gettext as gettext_module from django import http from django.conf import settings from django.template import Context, Template -from django.utils import importlib from django.utils.translation import check_for_language, to_locale, get_language from django.utils.encoding import smart_text from django.utils.formats import get_format_modules, get_format diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index f7036d13bd..3d6cd48b00 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -412,6 +412,8 @@ these changes. * ``django.utils.dictconfig`` will be removed. +* ``django.utils.importlib`` will be removed. + * ``django.utils.unittest`` will be removed. * If models are organized in a package, Django will no longer look for diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt index 0097d7ca96..e104159443 100644 --- a/docs/releases/1.7.txt +++ b/docs/releases/1.7.txt @@ -122,11 +122,12 @@ Miscellaneous Features deprecated in 1.7 ========================== -``django.utils.dictconfig`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``django.utils.dictconfig``/``django.utils.importlib`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -``django.utils.dictconfig`` was a copy of :mod:`logging.config` provided for -Python versions prior to 2.7. It has been deprecated. +``django.utils.dictconfig`` and ``django.utils.importlib`` were copies of +respectively :mod:`logging.config` and :mod:`importlib` provided for Python +versions prior to 2.7. They have been deprecated. ``django.utils.unittest`` ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index 019ed88cdb..8e6ec45ce1 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals import datetime import decimal +from importlib import import_module import os import pickle from threading import local @@ -17,7 +18,6 @@ from django.utils import translation from django.utils.formats import (get_format, date_format, time_format, localize, localize_input, iter_format_modules, get_format_modules, number_format, reset_format_cache, sanitize_separators) -from django.utils.importlib import import_module from django.utils.numberformat import format as nformat from django.utils._os import upath from django.utils.safestring import mark_safe, SafeBytes, SafeString, SafeText diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py index 72200e40d3..48651b37ff 100644 --- a/tests/test_runner/tests.py +++ b/tests/test_runner/tests.py @@ -3,6 +3,7 @@ Tests for django test runner """ from __future__ import absolute_import, unicode_literals +from importlib import import_module from optparse import make_option import sys import unittest @@ -13,7 +14,6 @@ from django import db from django.test import runner, TestCase, TransactionTestCase, skipUnlessDBFeature from django.test.testcases import connections_support_transactions from django.test.utils import IgnoreAllDeprecationWarningsMixin -from django.utils.importlib import import_module from admin_scripts.tests import AdminScriptTestCase from .models import Person diff --git a/tests/utils_tests/test_module_loading.py b/tests/utils_tests/test_module_loading.py index 5a43a927bf..2423215778 100644 --- a/tests/utils_tests/test_module_loading.py +++ b/tests/utils_tests/test_module_loading.py @@ -1,11 +1,11 @@ import imp +from importlib import import_module import os import sys import unittest from zipimport import zipimporter from django.core.exceptions import ImproperlyConfigured -from django.utils.importlib import import_module from django.utils.module_loading import import_by_path, module_has_submodule from django.utils._os import upath