forked from pool/python-celery
- Replace no-async.patch with three Python 3.7 patches merged upstream python37-1.patch, python37-2.patch & python37-3.patch - Replace sed invocation with unpin-pytest.patch for clarity OBS-URL: https://build.opensuse.org/request/show/677998 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-celery?expand=0&rev=114
121 lines
4.4 KiB
Diff
121 lines
4.4 KiB
Diff
From e7002769211f7340f38df80b3112706a8e07cafb Mon Sep 17 00:00:00 2001
|
|
From: Asif Saifuddin Auvi <auvipy@gmail.com>
|
|
Date: Mon, 9 Jul 2018 11:33:36 +0600
|
|
Subject: [PATCH] Python 3.7 compat issues (#4852)
|
|
|
|
* renamed banckend.async to asynchronous
|
|
|
|
* adjust redis imports of async
|
|
|
|
* adjust imports of async
|
|
|
|
* import style adjust
|
|
|
|
* renamed doc from async to asynchronous
|
|
|
|
* renamed doc contents from async to asynchronous
|
|
---
|
|
celery/backends/{async.py => asynchronous.py} | 0
|
|
celery/backends/redis.py | 7 ++++---
|
|
celery/backends/rpc.py | 2 +-
|
|
...backends.async.rst => celery.backends.asynchronous.rst} | 6 +++---
|
|
t/unit/backends/test_redis.py | 4 ++--
|
|
5 files changed, 10 insertions(+), 9 deletions(-)
|
|
rename celery/backends/{async.py => asynchronous.py} (100%)
|
|
rename docs/internals/reference/{celery.backends.async.rst => celery.backends.asynchronous.rst} (52%)
|
|
|
|
diff --git a/celery/backends/async.py b/celery/backends/asynchronous.py
|
|
similarity index 100%
|
|
rename from celery/backends/async.py
|
|
rename to celery/backends/asynchronous.py
|
|
diff --git a/celery/backends/redis.py b/celery/backends/redis.py
|
|
index 012db0f36e..6c311d8273 100644
|
|
--- a/celery/backends/redis.py
|
|
+++ b/celery/backends/redis.py
|
|
@@ -19,7 +19,8 @@
|
|
from celery.utils.log import get_logger
|
|
from celery.utils.time import humanize_seconds
|
|
|
|
-from . import async, base
|
|
+from .asynchronous import AsyncBackendMixin, BaseResultConsumer
|
|
+from .base import BaseKeyValueStoreBackend
|
|
|
|
try:
|
|
from urllib.parse import unquote
|
|
@@ -74,7 +75,7 @@
|
|
logger = get_logger(__name__)
|
|
|
|
|
|
-class ResultConsumer(async.BaseResultConsumer):
|
|
+class ResultConsumer(BaseResultConsumer):
|
|
_pubsub = None
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
@@ -138,7 +139,7 @@ def cancel_for(self, task_id):
|
|
self._pubsub.unsubscribe(key)
|
|
|
|
|
|
-class RedisBackend(base.BaseKeyValueStoreBackend, async.AsyncBackendMixin):
|
|
+class RedisBackend(BaseKeyValueStoreBackend, AsyncBackendMixin):
|
|
"""Redis task result store."""
|
|
|
|
ResultConsumer = ResultConsumer
|
|
diff --git a/celery/backends/rpc.py b/celery/backends/rpc.py
|
|
index 6e31cef75e..5e6e407ce6 100644
|
|
--- a/celery/backends/rpc.py
|
|
+++ b/celery/backends/rpc.py
|
|
@@ -17,7 +17,7 @@
|
|
from celery.five import items, range
|
|
|
|
from . import base
|
|
-from .async import AsyncBackendMixin, BaseResultConsumer
|
|
+from .asynchronous import AsyncBackendMixin, BaseResultConsumer
|
|
|
|
__all__ = ('BacklogLimitExceeded', 'RPCBackend')
|
|
|
|
diff --git a/docs/internals/reference/celery.backends.async.rst b/docs/internals/reference/celery.backends.asynchronous.rst
|
|
similarity index 52%
|
|
rename from docs/internals/reference/celery.backends.async.rst
|
|
rename to docs/internals/reference/celery.backends.asynchronous.rst
|
|
index 03d10feb33..fef524294e 100644
|
|
--- a/docs/internals/reference/celery.backends.async.rst
|
|
+++ b/docs/internals/reference/celery.backends.asynchronous.rst
|
|
@@ -1,12 +1,12 @@
|
|
=====================================
|
|
- ``celery.backends.async``
|
|
+ ``celery.backends.asynchronous``
|
|
=====================================
|
|
|
|
.. contents::
|
|
:local:
|
|
-.. currentmodule:: celery.backends.async
|
|
+.. currentmodule:: celery.backends.asynchronous
|
|
|
|
-.. automodule:: celery.backends.async
|
|
+.. automodule:: celery.backends.asynchronous
|
|
:members:
|
|
:undoc-members:
|
|
|
|
diff --git a/t/unit/backends/test_redis.py b/t/unit/backends/test_redis.py
|
|
index 166aa0dc34..6a7dbbd501 100644
|
|
--- a/t/unit/backends/test_redis.py
|
|
+++ b/t/unit/backends/test_redis.py
|
|
@@ -146,7 +146,7 @@ class _RedisBackend(RedisBackend):
|
|
def get_consumer(self):
|
|
return self.get_backend().result_consumer
|
|
|
|
- @patch('celery.backends.async.BaseResultConsumer.on_after_fork')
|
|
+ @patch('celery.backends.asynchronous.BaseResultConsumer.on_after_fork')
|
|
def test_on_after_fork(self, parent_method):
|
|
consumer = self.get_consumer()
|
|
consumer.start('none')
|
|
@@ -172,7 +172,7 @@ def test_on_after_fork(self, parent_method):
|
|
parent_method.assert_called_once()
|
|
|
|
@patch('celery.backends.redis.ResultConsumer.cancel_for')
|
|
- @patch('celery.backends.async.BaseResultConsumer.on_state_change')
|
|
+ @patch('celery.backends.asynchronous.BaseResultConsumer.on_state_change')
|
|
def test_on_state_change(self, parent_method, cancel_for):
|
|
consumer = self.get_consumer()
|
|
meta = {'task_id': 'testing', 'status': states.SUCCESS}
|