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

Function test_a_project_script_that_fails

lib/cli/tests/test_run_usage.py:999–1014  ·  view source on GitHub ↗

`uv run` exits 1 for a failed install, an import error and a crew that failed after kickoff alike, so the reason says only that the script failed; that run's kickoff spans tell them apart.

(project, usage, monkeypatch, pyproject, kind)

Source from the content-addressed store, hash-verified

997 [(CREW_PYPROJECT, "crew"), (FLOW_PYPROJECT, "flow")],
998)
999def test_a_project_script_that_fails(project, usage, monkeypatch, pyproject, kind) -> None:
1000 """`uv run` exits 1 for a failed install, an import error and a crew that
1001 failed after kickoff alike, so the reason says only that the script failed;
1002 that run's kickoff spans tell them apart."""
1003 write(project / "pyproject.toml", pyproject)
1004 fail_project_scripts(monkeypatch)
1005
1006 result = crewai_run()
1007
1008 # The script's own exit code, so CI and coding agents see the failure.
1009 assert result.exit_code == SCRIPT_EXIT_CODE
1010 assert f"An error occurred while running the {kind}" in result.output
1011 assert f"returned non-zero exit status {SCRIPT_EXIT_CODE}" in result.output
1012 assert f"{SECRET} failed" in result.output
1013 assert usage == [started(kind), stopped("script_failed")]
1014 assert_events_are_anonymous(usage)
1015
1016
1017def test_an_interrupted_project_script_counts_no_stop(project, usage, monkeypatch) -> None:

Callers

nothing calls this directly

Calls 6

fail_project_scriptsFunction · 0.85
startedFunction · 0.85
stoppedFunction · 0.85
writeFunction · 0.70
crewai_runFunction · 0.70

Tested by

no test coverage detected