Ask Solem 15 years ago
parent
commit
77dec97621

+ 2 - 5
celery/tests/compat.py

@@ -13,11 +13,8 @@ class WarningMessage(object):
         local_values = locals()
         for attr in self._WARNING_DETAILS:
             setattr(self, attr, local_values[attr])
-        
-        if category:
-            self._category_name = category.__name__
-        else:
-            self._category_name = None
+
+        self._category_name = category and category.__name__ or None
 
     def __str__(self):
         return ("{message : %r, category : %r, filename : %r, lineno : %s, "

+ 0 - 2
celery/tests/test_log.py

@@ -85,7 +85,6 @@ class TestLog(unittest.TestCase):
         context = override_stdouts()
         execute_context(context, with_override_stdouts)
 
-
     def test_setup_logger_no_handlers_file(self):
         from multiprocessing import get_logger
         l = get_logger()
@@ -127,7 +126,6 @@ class TestLog(unittest.TestCase):
         finally:
             sys.stdout, sys.stderr = sys.__stdout__, sys.__stderr__
 
-
     def test_logging_proxy(self):
         logger = setup_logger(loglevel=logging.ERROR, logfile=None)
 

+ 1 - 0
celery/tests/test_task_http.py

@@ -163,6 +163,7 @@ class TestHttpDispatch(unittest.TestCase):
         context = mock_urlopen(success_response(100))
         execute_context(context, with_mock_urlopen)
 
+
 class TestURL(unittest.TestCase):
 
     def test_URL_get_async(self):

+ 9 - 8
celery/tests/test_utils.py

@@ -33,17 +33,18 @@ class TestGenUniqueId(unittest.TestCase):
     def test_gen_unique_id_without_ctypes(self):
         from celery.tests.utils import mask_modules
         old_utils = sys.modules.pop("celery.utils")
-        try:
-            def with_ctypes_masked():
-                from celery.utils import ctypes, gen_unique_id
-                self.assertTrue(ctypes is None)
-                uuid = gen_unique_id()
-                self.assertTrue(uuid)
-                self.assertTrue(isinstance(uuid, basestring))
 
+        def with_ctypes_masked():
+            from celery.utils import ctypes, gen_unique_id
+
+            self.assertTrue(ctypes is None)
+            uuid = gen_unique_id()
+            self.assertTrue(uuid)
+            self.assertTrue(isinstance(uuid, basestring))
+
+        try:
             context = mask_modules("ctypes")
             execute_context(context, with_ctypes_masked)
-
         finally:
             sys.modules["celery.utils"] = old_utils
 

+ 4 - 1
celery/tests/utils.py

@@ -4,7 +4,9 @@ import os
 import sys
 import __builtin__
 from StringIO import StringIO
-from functools import wraps
+
+from billiard.utils.functional import wraps
+
 
 class GeneratorContextManager(object):
     def __init__(self, gen):
@@ -34,6 +36,7 @@ class GeneratorContextManager(object):
                 if sys.exc_info()[1] is not value:
                     raise
 
+
 def fallback_contextmanager(fun):
     def helper(*args, **kwds):
         return GeneratorContextManager(fun(*args, **kwds))