Browse Source

Backend.store_result now passes kwargs to real implementation

Ask Solem 14 years ago
parent
commit
0a75a82d3e
2 changed files with 6 additions and 14 deletions
  1. 2 2
      celery/backends/base.py
  2. 4 12
      celery/tests/test_backends/test_amqp.py

+ 2 - 2
celery/backends/base.py

@@ -152,10 +152,10 @@ class BaseDictBackend(BaseBackend):
         self._cache = LocalCache(limit=kwargs.get("max_cached_results") or
                                  self.app.conf.CELERY_MAX_CACHED_RESULTS)
 
-    def store_result(self, task_id, result, status, traceback=None):
+    def store_result(self, task_id, result, status, traceback=None, **kwargs):
         """Store task result and status."""
         result = self.encode_result(result, status)
-        return self._store_result(task_id, result, status, traceback)
+        return self._store_result(task_id, result, status, traceback, **kwargs)
 
     def forget(self, task_id):
         self._cache.pop(task_id, None)

+ 4 - 12
celery/tests/test_backends/test_amqp.py

@@ -10,9 +10,8 @@ from celery.datastructures import ExceptionInfo
 from celery.exceptions import TimeoutError
 from celery.utils import gen_unique_id
 
-from celery.tests.compat import catch_warnings
 from celery.tests.utils import unittest
-from celery.tests.utils import execute_context, sleepdeprived
+from celery.tests.utils import sleepdeprived
 
 
 class SomeClass(object):
@@ -91,7 +90,6 @@ class test_AMQPBackend(unittest.TestCase):
 
     @sleepdeprived()
     def test_store_result_retries(self):
-        from celery.backends.amqp import AMQResultWarning
 
         class _Producer(object):
             iterations = 0
@@ -112,15 +110,9 @@ class test_AMQPBackend(unittest.TestCase):
         self.assertRaises(KeyError, backend.store_result,
                           "foo", "bar", "STARTED", max_retries=None)
 
-        def with_catch_warnings(log):
-            backend.store_result("foo", "bar", "STARTED", max_retries=10)
-            return log[0].message
-
-        message = execute_context(catch_warnings(record=True),
-                                  with_catch_warnings)
-
-        self.assertIsInstance(message, AMQResultWarning)
-        self.assertIn("Error sending result", message.args[0])
+        print(backend.store_result)
+        self.assertRaises(KeyError, backend.store_result,
+                          "foo", "bar", "STARTED", max_retries=10)
 
     def assertState(self, retval, state):
         self.assertEqual(retval["status"], state)