From c7db4beb624cbae2a303cf928b9ba0721c70fc75 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 10 May 2007 12:07:34 +0000 Subject: [PATCH] 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 --- django/test/simple.py | 9 ++++++--- 1 file 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