Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #14487 -- Prevented unittest from leaking into scope via a 'fro…

…m 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
  • Loading branch information...
commit 8cb4bf5ef8418c8e76dacf40cc83eb0566d5bf56 1 parent 4cd18ee
Russell Keith-Magee authored October 18, 2010
2  django/test/client.py
@@ -26,6 +26,8 @@
26 26
 from django.db import transaction, close_connection
27 27
 from django.test.utils import ContextList
28 28
 
  29
+all = ('Client', 'RequestFactory', 'encode_file', 'encode_multipart')
  30
+
29 31
 BOUNDARY = 'BoUnDaRyStRiNg'
30 32
 MULTIPART_CONTENT = 'multipart/form-data; boundary=%s' % BOUNDARY
31 33
 CONTENT_TYPE_RE = re.compile('.*; charset=([\w\d-]+);?')
8  django/test/testcases.py
@@ -11,10 +11,12 @@
11 11
 from django.http import QueryDict
12 12
 from django.test import _doctest as doctest
13 13
 from django.test.client import Client
14  
-from django.utils import simplejson, unittest
  14
+from django.utils import simplejson, unittest as ut2
15 15
 from django.utils.encoding import smart_str
16 16
 from django.utils.functional import wraps
17 17
 
  18
+__all__ = ('DocTestRunner', 'OutputChecker', 'TestCase', 'TransactionTestCase',
  19
+           'skipIfDBFeature', 'skipUnlessDBFeature')
18 20
 
19 21
 try:
20 22
     all
@@ -233,7 +235,7 @@ def __exit__(self, exc_type, exc_value, traceback):
233 235
         )
234 236
 
235 237
 
236  
-class TransactionTestCase(unittest.TestCase):
  238
+class TransactionTestCase(ut2.TestCase):
237 239
     # The class we'll use for the test client self.client.
238 240
     # Can be overridden in derived classes.
239 241
     client_class = Client
@@ -581,7 +583,7 @@ def decorator(test_func):
581 583
             @wraps(test_func)
582 584
             def skip_wrapper(*args, **kwargs):
583 585
                 if condition():
584  
-                    raise unittest.SkipTest(reason)
  586
+                    raise ut2.SkipTest(reason)
585 587
                 return test_func(*args, **kwargs)
586 588
             test_item = skip_wrapper
587 589
         else:
2  django/test/utils.py
@@ -8,6 +8,8 @@
8 8
 from django.template import Template
9 9
 from django.utils.translation import deactivate
10 10
 
  11
+all = ('Approximate', 'ContextList', 'setup_test_environment',
  12
+       'teardown_test_environment', 'get_runner')
11 13
 
12 14
 class Approximate(object):
13 15
     def __init__(self, val, places=7):

0 notes on commit 8cb4bf5

Please sign in to comment.
Something went wrong with that request. Please try again.