#25542: Discover runner will raise AttributeError when test modules raise
ImportError
-----------------------------------+--------------------------------------
     Reporter:  hirokiky           |                    Owner:  nobody
         Type:  Bug                |                   Status:  new
    Component:  Testing framework  |                  Version:  master
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Unreviewed
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+--------------------------------------
Changes (by timgraham):

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


Comment:

 Not sure it can be solved or that it's Django's problem. From a
 [https://groups.google.com/d/msg/python-tornado/u1vD0WTugJA/gs7qw6s3QEkJ
 python-tornado thread]:

  It's a problem with python's unittest module (or really it's a problem
  with imprecise exception behavior from `__import__` - you can't
  distinguish between a module that doesn't exist and one that exists
  but could not be loaded due to an internal ImportError).  The unittest
  loader wants to support loading individual classes and methods, so
  when it sees an ImportError it just chops one level off the name and
  looks it up later with getattr.  I don't know of any workaround other
  than just retrying the import outside the test loader context (as long
  as you know it's supposed to be a module and not a class/method inside
  the module).  Python 2.7 made a lot of changes to the unittest module,
  but this issue remains.

--
Ticket URL: <https://code.djangoproject.com/ticket/25542#comment:1>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.b709d76478c1411fe100da826d2693c0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to