Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
Nusnus committed Mar 3, 2024
1 parent e85bf82 commit 8ce04ee
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 65 deletions.
3 changes: 1 addition & 2 deletions examples/django/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ sqlalchemy>=1.2.18
django>=2.2.1
pytest-django>=4.7.0
pytest-xdist>=3.5.0
pytest-celery~=1.0.0b
celery[redis,pymemcache]>=5.0.0
pytest-celery[all]@git+https://github.com/Katz-Consulting-Group/pytest-celery.git@bugfix
3 changes: 1 addition & 2 deletions examples/myutils/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pytest>=7.4.4
pytest-xdist>=3.5.0
pytest-celery~=1.0.0b
celery[redis,pymemcache]>=5.0.0
pytest-celery[all]@git+https://github.com/Katz-Consulting-Group/pytest-celery.git@bugfix
3 changes: 1 addition & 2 deletions examples/myworker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pytest>=7.4.4
pytest-xdist>=3.5.0
pytest-celery~=1.0.0b
celery[redis,pymemcache]>=5.0.0
pytest-celery[all]@git+https://github.com/Katz-Consulting-Group/pytest-celery.git@bugfix
3 changes: 1 addition & 2 deletions examples/rabbitmq_management/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pytest>=7.4.4
pytest-xdist>=3.5.0
pytest-celery~=1.0.0b
celery[redis,pymemcache]>=5.0.0
pytest-celery[all]@git+https://github.com/Katz-Consulting-Group/pytest-celery.git@bugfix
3 changes: 1 addition & 2 deletions examples/range/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pytest>=7.4.4
pytest-xdist>=3.5.0
pytest-subtests>=0.11.0
pytest-celery~=1.0.0b
celery[redis,pymemcache]>=5.0.0
pytest-celery[all]@git+https://github.com/Katz-Consulting-Group/pytest-celery.git@bugfix
42 changes: 23 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,22 @@ search = ':Version: {current_version}'
replace = ':Version: {new_version}'

[tool.poetry.dependencies]
celery = { version = "^5.0.0", extras = ["redis", "pymemcache"] }
celery = { version = "*", optional = true }
redis = { version = "*", optional = true }
python-memcached = { version = "*", optional = true }
python = ">= 3.8,<4.0"
retry = "^0.9.2"
pytest-docker-tools = "^3.1.3"
docker = "^7.0.0"
psutil = "^5.9.7"
setuptools = "^69.1.0"

[tool.poetry.extras]
all = ["celery", "redis", "python-memcached"]
celery = ["celery"]
redis = ["redis"]
memcached = ["python-memcached"]

[tool.poetry.group.dev]

[tool.poetry.group.dev.dependencies]
Expand Down
124 changes: 97 additions & 27 deletions src/pytest_celery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,104 @@
import re
from collections import namedtuple

from pytest_celery.api.backend import *
from pytest_celery.api.base import *
from pytest_celery.api.broker import *
from pytest_celery.api.container import *
from pytest_celery.api.setup import *
from pytest_celery.api.worker import *
from pytest_celery.api.backend import CeleryBackendCluster
from pytest_celery.api.backend import CeleryTestBackend
from pytest_celery.api.base import CeleryTestCluster
from pytest_celery.api.base import CeleryTestNode
from pytest_celery.api.broker import CeleryBrokerCluster
from pytest_celery.api.broker import CeleryTestBroker
from pytest_celery.api.container import CeleryTestContainer
from pytest_celery.api.setup import CeleryTestSetup
from pytest_celery.api.worker import CeleryTestWorker
from pytest_celery.api.worker import CeleryWorkerCluster
from pytest_celery.defaults import *
from pytest_celery.fixtures.backend import *
from pytest_celery.fixtures.broker import *
from pytest_celery.fixtures.setup import *
from pytest_celery.fixtures.worker import *
from pytest_celery.vendors.memcached.api import *
from pytest_celery.vendors.memcached.container import *
from pytest_celery.vendors.memcached.fixtures import *
from pytest_celery.vendors.rabbitmq.api import *
from pytest_celery.vendors.rabbitmq.container import *
from pytest_celery.vendors.rabbitmq.fixtures import *
from pytest_celery.vendors.redis.backend.api import *
from pytest_celery.vendors.redis.backend.fixtures import *
from pytest_celery.vendors.redis.broker.api import *
from pytest_celery.vendors.redis.broker.fixtures import *
from pytest_celery.vendors.redis.container import *
from pytest_celery.vendors.worker.container import *
from pytest_celery.vendors.worker.content import app
from pytest_celery.vendors.worker.content import utils
from pytest_celery.vendors.worker.fixtures import *
from pytest_celery.vendors.worker.tasks import *
from pytest_celery.vendors.worker.volume import *
from pytest_celery.fixtures.backend import celery_backend
from pytest_celery.fixtures.backend import celery_backend_cluster
from pytest_celery.fixtures.backend import celery_backend_cluster_config
from pytest_celery.fixtures.broker import celery_broker
from pytest_celery.fixtures.broker import celery_broker_cluster
from pytest_celery.fixtures.broker import celery_broker_cluster_config
from pytest_celery.fixtures.setup import celery_setup
from pytest_celery.fixtures.setup import celery_setup_app
from pytest_celery.fixtures.setup import celery_setup_cls
from pytest_celery.fixtures.setup import celery_setup_config
from pytest_celery.fixtures.setup import celery_setup_name
from pytest_celery.fixtures.worker import celery_worker
from pytest_celery.fixtures.worker import celery_worker_cluster
from pytest_celery.fixtures.worker import celery_worker_cluster_config
from pytest_celery.vendors import _is_vendor_installed

if _is_vendor_installed("memcached"):
from pytest_celery.vendors.memcached.api import MemcachedTestBackend
from pytest_celery.vendors.memcached.container import MemcachedContainer
from pytest_celery.vendors.memcached.defaults import *
from pytest_celery.vendors.memcached.fixtures import celery_memcached_backend
from pytest_celery.vendors.memcached.fixtures import default_memcached_backend
from pytest_celery.vendors.memcached.fixtures import default_memcached_backend_cls
from pytest_celery.vendors.memcached.fixtures import default_memcached_backend_env
from pytest_celery.vendors.memcached.fixtures import default_memcached_backend_image
from pytest_celery.vendors.memcached.fixtures import default_memcached_backend_ports

if _is_vendor_installed("rabbitmq"):
from pytest_celery.vendors.rabbitmq.api import RabbitMQTestBroker
from pytest_celery.vendors.rabbitmq.container import RabbitMQContainer
from pytest_celery.vendors.rabbitmq.defaults import *
from pytest_celery.vendors.rabbitmq.fixtures import celery_rabbitmq_broker
from pytest_celery.vendors.rabbitmq.fixtures import default_rabbitmq_broker
from pytest_celery.vendors.rabbitmq.fixtures import default_rabbitmq_broker_cls
from pytest_celery.vendors.rabbitmq.fixtures import default_rabbitmq_broker_env
from pytest_celery.vendors.rabbitmq.fixtures import default_rabbitmq_broker_image
from pytest_celery.vendors.rabbitmq.fixtures import default_rabbitmq_broker_ports

if _is_vendor_installed("redis"):
from pytest_celery.vendors.redis.backend.api import RedisTestBackend
from pytest_celery.vendors.redis.backend.defaults import *
from pytest_celery.vendors.redis.backend.fixtures import celery_redis_backend
from pytest_celery.vendors.redis.backend.fixtures import default_redis_backend
from pytest_celery.vendors.redis.backend.fixtures import default_redis_backend_cls
from pytest_celery.vendors.redis.backend.fixtures import default_redis_backend_command
from pytest_celery.vendors.redis.backend.fixtures import default_redis_backend_env
from pytest_celery.vendors.redis.backend.fixtures import default_redis_backend_image
from pytest_celery.vendors.redis.backend.fixtures import default_redis_backend_ports
from pytest_celery.vendors.redis.broker.api import RedisTestBroker
from pytest_celery.vendors.redis.broker.defaults import *
from pytest_celery.vendors.redis.broker.fixtures import celery_redis_broker
from pytest_celery.vendors.redis.broker.fixtures import default_redis_broker
from pytest_celery.vendors.redis.broker.fixtures import default_redis_broker_cls
from pytest_celery.vendors.redis.broker.fixtures import default_redis_broker_command
from pytest_celery.vendors.redis.broker.fixtures import default_redis_broker_env
from pytest_celery.vendors.redis.broker.fixtures import default_redis_broker_image
from pytest_celery.vendors.redis.broker.fixtures import default_redis_broker_ports
from pytest_celery.vendors.redis.container import RedisContainer
from pytest_celery.vendors.redis.defaults import *


if _is_vendor_installed("worker"):
from pytest_celery.vendors.worker.container import CeleryWorkerContainer
from pytest_celery.vendors.worker.content import app
from pytest_celery.vendors.worker.content import utils
from pytest_celery.vendors.worker.fixtures import celery_base_worker_image
from pytest_celery.vendors.worker.fixtures import celery_setup_worker
from pytest_celery.vendors.worker.fixtures import default_worker_app
from pytest_celery.vendors.worker.fixtures import default_worker_app_module
from pytest_celery.vendors.worker.fixtures import default_worker_celery_log_level
from pytest_celery.vendors.worker.fixtures import default_worker_celery_version
from pytest_celery.vendors.worker.fixtures import default_worker_celery_worker_name
from pytest_celery.vendors.worker.fixtures import default_worker_celery_worker_queue
from pytest_celery.vendors.worker.fixtures import default_worker_cls
from pytest_celery.vendors.worker.fixtures import default_worker_command
from pytest_celery.vendors.worker.fixtures import default_worker_container
from pytest_celery.vendors.worker.fixtures import default_worker_container_cls
from pytest_celery.vendors.worker.fixtures import default_worker_container_session_cls
from pytest_celery.vendors.worker.fixtures import default_worker_env
from pytest_celery.vendors.worker.fixtures import default_worker_initial_content
from pytest_celery.vendors.worker.fixtures import default_worker_signals
from pytest_celery.vendors.worker.fixtures import default_worker_tasks
from pytest_celery.vendors.worker.fixtures import default_worker_utils_module
from pytest_celery.vendors.worker.fixtures import default_worker_volume
from pytest_celery.vendors.worker.tasks import ping
from pytest_celery.vendors.worker.volume import WorkerInitialContent


version_info_t = namedtuple(
"version_info_t",
Expand Down
26 changes: 18 additions & 8 deletions src/pytest_celery/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from pytest_docker_tools import network

from pytest_celery.vendors import _is_vendor_installed
from pytest_celery.vendors.memcached.defaults import CELERY_MEMCACHED_BACKEND
from pytest_celery.vendors.memcached.defaults import *
from pytest_celery.vendors.rabbitmq.defaults import CELERY_RABBITMQ_BROKER
Expand All @@ -28,15 +29,24 @@
# will automatically add it to the parametrization of every (relevant) test IMPLICITLY!
# Tests that do not rely on default parametrization will not be affected.


ALL_CELERY_BACKENDS = []
ALL_CELERY_BROKERS = []

if _is_vendor_installed("redis"):
ALL_CELERY_BACKENDS.append(CELERY_REDIS_BACKEND)
ALL_CELERY_BROKERS.append(CELERY_REDIS_BROKER)

if _is_vendor_installed("rabbitmq"):
# Uses Kombu
ALL_CELERY_BROKERS.append(CELERY_RABBITMQ_BROKER)

# Beta support at the moment, to be used manually
# if can_import_container('memcached'):
# ALL_CELERY_BACKENDS.append(CELERY_MEMCACHED_BACKEND)

# Worker setup is assumed to be always available.
ALL_CELERY_WORKERS = (CELERY_SETUP_WORKER,)
ALL_CELERY_BACKENDS = (
CELERY_REDIS_BACKEND,
# CELERY_MEMCACHED_BACKEND, # Beta support at the moment, to be used manually
)
ALL_CELERY_BROKERS = (
CELERY_REDIS_BROKER,
CELERY_RABBITMQ_BROKER,
)

####################################################################################
# Fixtures
Expand Down
Loading

0 comments on commit 8ce04ee

Please sign in to comment.