summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2007-05-10 12:07:34 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2007-05-10 12:07:34 +0000
commitc7db4beb624cbae2a303cf928b9ba0721c70fc75 (patch)
tree9b4f9762c6e5aec7c3e77c797d40410a566908dc
parent5c68ab6e2902b3cf67456d080c5314d3696d43e8 (diff)
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
-rw-r--r--django/test/simple.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/django/test/simple.py b/django/test/simple.py
index fed6237929..cfaa09a0a4 100644
--- a/django/test/simple.py
+++ b/django/test/simple.py
@@ -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