def METHOD_NAME(setup_scratch_org, plan_factory, caplog):
    caplog.set_level(logging.INFO)
    setup_scratch_org.side_effect = Exception("Scratch org creation failed")
    plan = plan_factory(preflight_checks=[{"when": "False", "action": "error"}])
    with pytest.raises(Exception, match="Scratch org creation failed"):
        call_command("run_plan", str(plan.id))
    assert "Scratch org creation failed" in caplog.text