Commits

kkub...@bcc190cf-cafb-0310-a4f2-bffc1f526a37  committed 059d740

[gsoc2009-testing] Use importlib from django.util in attempt_import

  • Participants
  • Parent commits c5176c8
  • Branches soc2009/test-improvements

Comments (0)

Files changed (1)

File django/core/management/commands/test_windmill.py

 import types
 import logging
 import threading
-
+from django.utils import importlib
 class ServerContainer(object):
     start_test_server = djangotest.start_test_server
     stop_test_server = djangotest.stop_test_server
 
 def attempt_import(name, suffix):
     try:
-        mod = __import__(name+'.'+suffix)
+        mod = importlib.import_module(name+'.'+suffix)
     except ImportError:
         mod = None
     if mod is not None:
         s = name.split('.')
-        mod = __import__(s.pop(0))
+        mod = importlib.import_module(s.pop(0))
         for x in s+[suffix]:
             try:
                 mod = getattr(mod, x)