Author: russellm
Date: 2006-09-09 09:58:46 -0500 (Sat, 09 Sep 2006)
New Revision: 3740
Modified:
django/trunk/django/test/simple.py
Log:
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.
Modified: django/trunk/django/test/simple.py
===================================================================
--- django/trunk/django/test/simple.py 2006-09-08 16:35:39 UTC (rev 3739)
+++ django/trunk/django/test/simple.py 2006-09-09 14:58:46 UTC (rev 3740)
@@ -38,10 +38,23 @@
except ValueError:
# No doc tests in tests.py
pass
- except ImportError:
- # No tests.py file for application
- 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:
+ # 'tests' module doesn't exist. Move on.
+ 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
def run_tests(module_list, verbosity=1, extra_tests=[]):
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---