celery.contrib.testing.app
Create Celery app instances used for testing.
- celery.contrib.testing.app.DEFAULT_TEST_CONFIG={'accept_content': {'json'}, 'broker_heartbeat': 0, 'broker_url': 'memory://', 'enable_utc': True, 'result_backend': 'cache+memory://', 'timezone': 'UTC', 'worker_hijack_root_logger': False, 'worker_log_color': False}
-
Contains the default configuration values for the test app.
- celery.contrib.testing.app.TestApp(name=None, config=None, enable_logging=False, set_as_current=False, log=<class 'celery.contrib.testing.app.UnitLogging'>, backend=None, broker=None, **kwargs)
-
App used for testing.
- classcelery.contrib.testing.app.Trap
-
Trap that pretends to be an app but raises an exception instead.
This to protect from code that does not properly pass app instances, then falls back to the current_app.
- classcelery.contrib.testing.app.UnitLogging(*args, **kwargs)
-
Sets up logging for the test application.
- celery.contrib.testing.app.set_trap(app)
-
Contextmanager that installs the trap app.
The trap means that anything trying to use the current or default app will raise an exception.
- celery.contrib.testing.app.setup_default_app(app, use_trap=False)
-
Setup default app for testing.
Ensures state is clean after the test returns.
Copyright © 2017-2026 Asif Saif Uddin, core team & contributors. All rights reserved.
Celery is licensed under The BSD License (3 Clause, also known as the new BSD license). The license is an OSI approved Open Source license and is GPL-compatible.
https://docs.celeryq.dev/en/stable/reference/celery.contrib.testing.app.html