This document describes the current stable version of Celery (4.3). For development docs, go here.

celery.contrib.testing.manager

API Reference

Integration testing utilities.

class celery.contrib.testing.manager.Manager(app, **kwargs)[source]

Test helpers for task integration tests.

class celery.contrib.testing.manager.ManagerMixin[source]

Mixin that adds Manager capabilities.

assert_accepted(ids, interval=0.5, desc='waiting for tasks to be accepted', **policy)[source]
assert_received(ids, interval=0.5, desc='waiting for tasks to be received', **policy)[source]
assert_result_tasks_in_progress_or_completed(async_results, interval=0.5, desc='waiting for tasks to be started or completed', **policy)[source]
assert_task_state_from_result(fun, results, interval=0.5, **policy)[source]
assert_task_worker_state(fun, ids, interval=0.5, **policy)[source]
ensure_not_for_a_while(fun, catch, desc='thing', max_retries=20, interval_start=0.1, interval_step=0.02, interval_max=1.0, emit_warning=False, **options)[source]

Make sure something does not happen (at least for a while).

inspect(timeout=3.0)[source]
is_accepted(ids, **kwargs)[source]
is_received(ids, **kwargs)[source]
static is_result_task_in_progress(results, **kwargs)[source]
join(r, propagate=False, max_retries=10, **kwargs)[source]
missing_results(r)[source]
query_task_states(ids, timeout=0.5)[source]
query_tasks(ids, timeout=0.5)[source]
remark(s, sep='-')[source]
retry_over_time(*args, **kwargs)[source]
true_or_raise(fun, *args, **kwargs)[source]
wait_for(fun, catch, desc='thing', args=(), kwargs={}, errback=None, max_retries=10, interval_start=0.1, interval_step=0.5, interval_max=5.0, emit_warning=False, **options)[source]

Wait for event to happen.

The catch argument specifies the exception that means the event has not happened yet.

exception celery.contrib.testing.manager.Sentinel[source]

Signifies the end of something.

celery.contrib.testing.manager.humanize_seconds(secs, prefix='', sep='', now='now', *, microseconds=True)

Show seconds in human form.

For example, 60 becomes “1 minute”, and 7200 becomes “2 hours”.

Parameters:
  • prefix (str) – can be used to add a preposition to the output (e.g., ‘in’ will give ‘in 1 second’, but add nothing to ‘now’).
  • now (str) – Literal ‘now’.
  • microseconds (bool) – Include microseconds.