Skip to content

task_handler_service_locator

Scope: function | Returns: DependencyContainer

The task_handler_service_locator fixture bootstraps and sets the global service locator with the task handler's component registrations. Use it in tests that execute background tasks.

Info

Calling a task function directly — as a plain Python function — does not require this fixture. It is needed when the test exercises the task handler machinery itself.

Basic usage

Apply it via usefixtures so the container is configured before the test body runs:

@pytest.mark.usefixtures("task_handler_service_locator")
def test_my_task_runs():
    ...