Ask Solem 9 vuotta sitten
vanhempi
commit
cab69f9f8e

+ 3 - 3
celery/backends/new_cassandra.py

@@ -164,9 +164,9 @@ class CassandraBackend(BaseBackend):
                     # where both task-creator and task-executor would issue it
                     # at the same time.
 
-                    # Anyway, if you are doing anything critical, you should
-                    # have probably created this table in advance, in which case
-                    # this query will be a no-op (instant fail with AlreadyExists)
+                    # Anyway; if you're doing anything critical, you should
+                    # have created this table in advance, in which case
+                    # this query will be a no-op (AlreadyExists)
                     self._make_stmt = cassandra.query.SimpleStatement(
                         Q_CREATE_RESULT_TABLE.format(table=self.table),
                     )

+ 3 - 3
celery/tests/backends/test_new_cassandra.py

@@ -127,9 +127,9 @@ class test_CassandraBackend(AppCase):
 
             x = mod.CassandraBackend(app=self.app)
 
-            self.assertRaises(OTOExc, lambda: x._store_result('task_id', 'result', states.SUCCESS))
+            with self.assertRaises(OTOExc):
+                x._store_result('task_id', 'result', states.SUCCESS)
             self.assertIsNone(x._connection)
             self.assertIsNone(x._session)
 
-            x.process_cleanup() # assert it doesn't raise
-
+            x.process_cleanup()  # should not raise