12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import os
- import pytest
- from celery.contrib.testing.manager import Manager
- TEST_BROKER = os.environ.get('TEST_BROKER', 'pyamqp://')
- TEST_BACKEND = os.environ.get('TEST_BACKEND', 'redis://')
- @pytest.fixture(scope='session')
- def celery_config():
- assert TEST_BACKEND == 'rpc'
- return {
- 'broker_url': TEST_BROKER,
- 'result_backend': TEST_BACKEND
- }
- @pytest.fixture(scope='session')
- def celery_enable_logging():
- return True
- @pytest.fixture(scope='session')
- def celery_worker_pool():
- return 'prefork'
- @pytest.fixture(scope='session')
- def celery_includes():
- return {'t.integration.tasks'}
- @pytest.fixture
- def app(celery_app):
- yield celery_app
- @pytest.fixture
- def manager(app, celery_session_worker):
- return Manager(app)
- @pytest.fixture(autouse=True)
- def ZZZZ_set_app_current(app):
- app.set_current()
- app.set_default()
|