#12658: Import Errors in test files cause tests to be split.
----------------------------------------+-----------------------------------
          Reporter:  schinckel          |         Owner:  nobody
            Status:  new                |     Milestone:        
         Component:  Testing framework  |       Version:  1.1   
        Resolution:                     |      Keywords:        
             Stage:  Unreviewed         |     Has_patch:  0     
        Needs_docs:  0                  |   Needs_tests:  0     
Needs_better_patch:  0                  |  
----------------------------------------+-----------------------------------
Changes (by schinckel):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 More information: it only occurs if both the tests file and the models
 file have been split into folders.  This is due to the line in
 django.test.simple.get_tests that tries again to find the module:

 mod = find_module(TEST_MODULE, [os.path.dirname(app_module.__file__)])

 At this point, if the models file has been split, then app_module.__file__
 is the __init__.py file in the models directory, so os.path.dirname() of
 this gets the model directory, not the app directory.  Thus, no tests
 module can be found (unless there was one in the models directory).

 A really hacky solution is to capture the internal exception, and compare
 the arguments of the two exceptions. If they match, then it is the tests
 module that is missing. If it isn't then the problem is an import. I'm
 sure there is a much nicer solution, though. I'm not really even game to
 submit a patch for mine!

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12658#comment:1>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
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?hl=en.

Reply via email to