소스 검색

App: Regression registry_cls no longer had any effect. Closes #3613

Ask Solem 8 년 전
부모
커밋
4218536e4c
2개의 변경된 파일12개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      celery/app/base.py
  2. 11 0
      t/unit/app/test_app.py

+ 1 - 1
celery/app/base.py

@@ -261,7 +261,7 @@ class Celery(object):
         self._pending = deque()
         self._tasks = tasks
         if not isinstance(self._tasks, TaskRegistry):
-            self._tasks = TaskRegistry(self._tasks or {})
+            self._tasks = self.registry_cls(self._tasks or {})
 
         # If the class defines a custom __reduce_args__ we need to use
         # the old way of pickling apps: pickling a list of

+ 11 - 0
t/unit/app/test_app.py

@@ -901,6 +901,17 @@ class test_App:
         beat = self.app.Beat()
         assert isinstance(beat, Beat)
 
+    def test_registry_cls(self):
+
+        class TaskRegistry(self.app.registry_cls):
+            pass
+
+        class CustomCelery(type(self.app)):
+            registry_cls = TaskRegistry
+
+        app = CustomCelery(set_as_current=False)
+        assert isinstance(app.tasks, TaskRegistry)
+
 
 class test_defaults: