mirror of
https://github.com/django/django.git
synced 2025-01-10 18:36:05 +00:00
Fixes #2669 -- Added check on import of tests.py to differentiate between an absent tests.py, and an existent tests.py with an import error in it.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3740 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5b34781f28
commit
36added124
@ -38,9 +38,22 @@ def build_suite(app_module):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
# No doc tests in tests.py
|
# No doc tests in tests.py
|
||||||
pass
|
pass
|
||||||
|
except ImportError, e:
|
||||||
|
# Couldn't import tests.py. Was it due to a missing file, or
|
||||||
|
# due to an import error in a tests.py that actually exists?
|
||||||
|
import os.path
|
||||||
|
from imp import find_module
|
||||||
|
try:
|
||||||
|
mod = find_module(TEST_MODULE, [os.path.dirname(app_module.__file__)])
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# No tests.py file for application
|
# 'tests' module doesn't exist. Move on.
|
||||||
pass
|
pass
|
||||||
|
else:
|
||||||
|
# The module exists, so there must be an import error in the
|
||||||
|
# test module itself. We don't need the module; close the file
|
||||||
|
# handle returned by find_module.
|
||||||
|
mod[0].close()
|
||||||
|
raise
|
||||||
|
|
||||||
return suite
|
return suite
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user