def METHOD_NAME(mocker, config, event_loop):
    async def foo(*args):
        raise WorkerError("foo")
    fake_run_tasks = mocker.MagicMock()
    fake_run_tasks.invoke = foo
    mocker.patch.object(worker, "RunTasks", return_value=fake_run_tasks)
    tmp = os.path.join(config["work_dir"], "foo")
    with open(tmp, "w") as fh:
        json.dump(config, fh)
    mocker.patch.object(sys, "argv", new=["x", tmp])
    with pytest.raises(WorkerError):
        worker.main(event_loop=event_loop)