MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / _a_crew_whose_script_fails

Function _a_crew_whose_script_fails

lib/cli/tests/experimental/test_eval_crew.py:4340–4357  ·  view source on GitHub ↗

The real `crewai run` on a classic crew whose `uv run run_crew` exits 3, or raises FAILURE.

(
    directory: Path, monkeypatch, *, traced: bool, failure: Exception | None = None
)

Source from the content-addressed store, hash-verified

4338
4339
4340def _a_crew_whose_script_fails(
4341 directory: Path, monkeypatch, *, traced: bool, failure: Exception | None = None
4342) -> None:
4343 """The real `crewai run` on a classic crew whose `uv run run_crew` exits 3,
4344 or raises FAILURE."""
4345 (directory / "pyproject.toml").write_text('[project]\nname = "demo"\n\n[tool.crewai]\ntype = "crew"\n')
4346 (directory / ".env").write_text("CREWAI_TRACING_ENABLED=true\n")
4347 monkeypatch.delenv(run_crew_module.RUN_COUNTED_ENV, raising=False)
4348 monkeypatch.setattr(run_crew_module, "ask_for_missing_api_keys", lambda *args: None)
4349
4350 def uv_run(command, **kwargs):
4351 os.write(2, b"KeyError: 'topic'\n")
4352 if traced:
4353 record_last_run(directory, "the-failed-run", recorded_at=_now())
4354 raise failure or subprocess.CalledProcessError(3, command)
4355
4356 monkeypatch.setattr(subprocess, "run", uv_run)
4357 monkeypatch.setattr(run_crew_module, "run_crew", _REAL_RUN_CREW)
4358
4359
4360def test_a_traced_run_whose_script_failed_is_still_graded(project, monkeypatch, capfd):

Calls

no outgoing calls

Tested by

no test coverage detected