Fixed #15368 -- Ensure that raw unittest TestCase instances can be invoked individually by the test runner. Thanks to SmileyChris for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15876 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5347bbd514
commit
fa852966c6
|
@ -1,3 +1,4 @@
|
||||||
|
import unittest as real_unittest
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.db.models import get_app, get_apps
|
from django.db.models import get_app, get_apps
|
||||||
|
@ -113,7 +114,7 @@ def build_test(label):
|
||||||
TestClass = getattr(test_module, parts[1], None)
|
TestClass = getattr(test_module, parts[1], None)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if issubclass(TestClass, unittest.TestCase):
|
if issubclass(TestClass, (unittest.TestCase, real_unittest.TestCase)):
|
||||||
if len(parts) == 2: # label is app.TestClass
|
if len(parts) == 2: # label is app.TestClass
|
||||||
try:
|
try:
|
||||||
return unittest.TestLoader().loadTestsFromTestCase(TestClass)
|
return unittest.TestLoader().loadTestsFromTestCase(TestClass)
|
||||||
|
|
Loading…
Reference in New Issue