浏览代码

Tests: Make it possible to run suite without celery pytest plugin. Closes #3530

Ask Solem 8 年之前
父节点
当前提交
d0c8898f40
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      t/unit/conftest.py

+ 11 - 0
t/unit/conftest.py

@@ -15,11 +15,22 @@ from case.utils import decorator
 from kombu import Queue
 from kombu import Queue
 
 
 from celery.backends.cache import CacheBackend, DummyClient
 from celery.backends.cache import CacheBackend, DummyClient
+# we have to import the pytest plugin fixtures here,
+# in case user did not do the `python setup.py develop` yet,
+# that installs the pytest plugin into the setuptools registry.
+from celery.contrib.pytest import (
+    celery_app, celery_enable_logging, depends_on_current_app,
+)
 from celery.contrib.testing.app import Trap, TestApp
 from celery.contrib.testing.app import Trap, TestApp
 from celery.contrib.testing.mocks import (
 from celery.contrib.testing.mocks import (
     TaskMessage, TaskMessage1, task_message_from_sig,
     TaskMessage, TaskMessage1, task_message_from_sig,
 )
 )
 
 
+# Tricks flake8 into silencing redefining fixtures warnings.
+__all__ = [
+    'celery_app', 'celery_enable_logging', 'depends_on_current_app',
+]
+
 try:
 try:
     WindowsError = WindowsError  # noqa
     WindowsError = WindowsError  # noqa
 except NameError:
 except NameError: