mirror of
https://github.com/django/django.git
synced 2025-02-28 11:34:28 +00:00
Fixed #14487 -- Prevented unittest from leaking into scope via a 'from django.test.testcases import *' import. Thanks to Jannis for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14258 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4cd18ee32d
commit
8cb4bf5ef8
@ -26,6 +26,8 @@ from django.utils.itercompat import is_iterable
|
|||||||
from django.db import transaction, close_connection
|
from django.db import transaction, close_connection
|
||||||
from django.test.utils import ContextList
|
from django.test.utils import ContextList
|
||||||
|
|
||||||
|
all = ('Client', 'RequestFactory', 'encode_file', 'encode_multipart')
|
||||||
|
|
||||||
BOUNDARY = 'BoUnDaRyStRiNg'
|
BOUNDARY = 'BoUnDaRyStRiNg'
|
||||||
MULTIPART_CONTENT = 'multipart/form-data; boundary=%s' % BOUNDARY
|
MULTIPART_CONTENT = 'multipart/form-data; boundary=%s' % BOUNDARY
|
||||||
CONTENT_TYPE_RE = re.compile('.*; charset=([\w\d-]+);?')
|
CONTENT_TYPE_RE = re.compile('.*; charset=([\w\d-]+);?')
|
||||||
|
@ -11,10 +11,12 @@ from django.db import transaction, connection, connections, DEFAULT_DB_ALIAS
|
|||||||
from django.http import QueryDict
|
from django.http import QueryDict
|
||||||
from django.test import _doctest as doctest
|
from django.test import _doctest as doctest
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
from django.utils import simplejson, unittest
|
from django.utils import simplejson, unittest as ut2
|
||||||
from django.utils.encoding import smart_str
|
from django.utils.encoding import smart_str
|
||||||
from django.utils.functional import wraps
|
from django.utils.functional import wraps
|
||||||
|
|
||||||
|
__all__ = ('DocTestRunner', 'OutputChecker', 'TestCase', 'TransactionTestCase',
|
||||||
|
'skipIfDBFeature', 'skipUnlessDBFeature')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
all
|
all
|
||||||
@ -233,7 +235,7 @@ class _AssertNumQueriesContext(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class TransactionTestCase(unittest.TestCase):
|
class TransactionTestCase(ut2.TestCase):
|
||||||
# The class we'll use for the test client self.client.
|
# The class we'll use for the test client self.client.
|
||||||
# Can be overridden in derived classes.
|
# Can be overridden in derived classes.
|
||||||
client_class = Client
|
client_class = Client
|
||||||
@ -581,7 +583,7 @@ def _deferredSkip(condition, reason):
|
|||||||
@wraps(test_func)
|
@wraps(test_func)
|
||||||
def skip_wrapper(*args, **kwargs):
|
def skip_wrapper(*args, **kwargs):
|
||||||
if condition():
|
if condition():
|
||||||
raise unittest.SkipTest(reason)
|
raise ut2.SkipTest(reason)
|
||||||
return test_func(*args, **kwargs)
|
return test_func(*args, **kwargs)
|
||||||
test_item = skip_wrapper
|
test_item = skip_wrapper
|
||||||
else:
|
else:
|
||||||
|
@ -8,6 +8,8 @@ from django.test import signals
|
|||||||
from django.template import Template
|
from django.template import Template
|
||||||
from django.utils.translation import deactivate
|
from django.utils.translation import deactivate
|
||||||
|
|
||||||
|
all = ('Approximate', 'ContextList', 'setup_test_environment',
|
||||||
|
'teardown_test_environment', 'get_runner')
|
||||||
|
|
||||||
class Approximate(object):
|
class Approximate(object):
|
||||||
def __init__(self, val, places=7):
|
def __init__(self, val, places=7):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user