contrib.testing.app

Create Celery app instances used for testing.

Module Contents

Classes

Trap() Trap that pretends to be an app but raises an exception instead.
UnitLogging(self,*args,**kwargs) Sets up logging for the test application.

Functions

TestApp(name=None,config=None,enable_logging=False,set_as_current=False,log=UnitLogging,backend=None,broker=None,**kwargs) App used for testing.
set_trap(app) Contextmanager that installs the trap app.
setup_default_app(app,use_trap=False) Setup default app for testing.
class 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.

__getattr__(name)
class UnitLogging(*args, **kwargs)

Sets up logging for the test application.

__init__(*args, **kwargs)
TestApp(name=None, config=None, enable_logging=False, set_as_current=False, log=UnitLogging, backend=None, broker=None, **kwargs)

App used for testing.

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.

setup_default_app(app, use_trap=False)

Setup default app for testing.

Ensures state is clean after the test returns.