Fixed import error handling when application tests are stored in a tests directory, rather than a tests.py file.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5180 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2007-05-10 12:07:34 +00:00
parent 5c68ab6e29
commit c7db4beb62
1 changed files with 6 additions and 3 deletions

View File

@ -49,9 +49,12 @@ def build_suite(app_module):
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()
# test module itself. We don't need the module; so if the
# module was a single file module (i.e., tests.py), close the file
# handle returned by find_module. Otherwise, the test module
# is a directory, and there is nothing to close.
if mod[0]:
mod[0].close()
raise
return suite