Opened 12 years ago

Closed 12 years ago

#2669 closed defect (fixed)

Test system cannot differentiate between missing and import error in

Reported by: Russell Keith-Magee Owned by: Russell Keith-Magee
Component: Testing framework Version: master
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Ned Batchelder reports that because the test runner uses speculative imports to find tests that may or may not exist, ImportErrors in the tests themselves are usually cloaked, and are hard to debug.

One suggested fix is to modify django/test/, line 41, to this:

   except ImportError, exc:
       # No file for application, or some other import error.
       if str(exc) != 'No module named %s' % TEST_MODULE:
           # It's something other than a missing tests module, probably
a real
           # error, so show the user.
           import traceback

This is less than ideal; testing error strings is fragile and prone to locale problems. Testing for the existence of is also unreliable; tests may be a directory module.

Change History (2)

comment:1 Changed 12 years ago by Russell Keith-Magee

Status: newassigned

comment:2 Changed 12 years ago by Russell Keith-Magee

Resolution: fixed
Status: assignedclosed

(In [3740]) Fixes #2669 -- Added check on import of to differentiate between an absent, and an existent with an import error in it.

Note: See TracTickets for help on using tickets.
Back to Top