Closed lorin closed 12 years ago
I'm researching and I can not find a solution. Is there any workaround?
I think I found the reason for this failure. I think it's a bug in import of class when you're in python2.7, or have installed unittest2 module.
See the file in the line 128 on https://github.com/django/django/blob/master/django/utils/unittest/loader.py:
case.TestCase
refers to django.utils.unittest.case.TestCase
but,
django.test.TestCase
is inherit from django.utils.unittest.TestCase.
On python2.7, or with unittest2 installed, django.utils.unittest.TestCase
is not the same class as django.utils.unittest.case.TestCase
. Because on django.utils.unittest.__init__
if unittest2 module is instaled or your are use python2.7, imports original clases.
For this reason, the condition is not met the line 126 and can not run a particular method of a testcase.
I can reproduce the errors and could work around it for now by doing this:
from django.utils.unittest.case import TestCase as BaseTestCase
from django.test import TestCase
class MyTestCase(BaseTestCase, TestCase):
# whatever
Let me know if that fixes it for you, too.
Confirmed, this resolves my issue. Thanks for the fix.
Is it possible to specify individual test methods on the command line? If I try it like this:
Then I get an error like this: