Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Minor cleanup to the select_for_update tests (as suggested by Alex Ga…

…ynor).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16060 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6488f15a8efa6861361b6dbef02b890a997a75aa 1 parent c92e0e4
Jacob Kaplan-Moss authored April 20, 2011
12  tests/modeltests/select_for_update/tests.py
@@ -11,17 +11,13 @@
11 11
 
12 12
 from models import Person
13 13
 
  14
+# Some tests require threading, which might not be available. So create a
  15
+# skip-test decorator for those test functions.
14 16
 try:
15 17
     import threading
16  
-    def requires_threading(func):
17  
-        return func
18 18
 except ImportError:
19  
-    # Note we can't use dummy_threading here, as our tests will actually
20  
-    # block. We just have to skip the test completely.
21  
-    def requires_threading(func):
22  
-        @wraps(func)
23  
-        def wrapped(*args, **kw):
24  
-            raise unittest.SkipTest('threading required')
  19
+    threading = None
  20
+requires_threading = unittest.skipUnless(threading, 'requires threading')
25 21
 
26 22
 class SelectForUpdateTests(TransactionTestCase):
27 23
 

0 notes on commit 6488f15

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