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

Function _record_runs

lib/cli/tests/test_cli.py:438–453  ·  view source on GitHub ↗

Record each `crewai run` that create starts. Other commands, such as git, run for real.

(
    monkeypatch, returncode: int = 0, interrupts: int = 0
)

Source from the content-addressed store, hash-verified

436
437
438def _record_runs(
439 monkeypatch, returncode: int = 0, interrupts: int = 0
440) -> list[_StartedRun]:
441 """Record each `crewai run` that create starts. Other commands, such as git,
442 run for real."""
443 real_popen = subprocess.Popen
444 runs: list[_StartedRun] = []
445
446 def fake_popen(args, **kwargs):
447 if args != RUN_ARGV:
448 return real_popen(args, **kwargs)
449 runs.append(_StartedRun(args, kwargs, returncode, interrupts))
450 return runs[-1]
451
452 monkeypatch.setattr(subprocess, "Popen", fake_popen)
453 return runs
454
455
456def _create(args: list[str]) -> None:

Calls

no outgoing calls

Tested by

no test coverage detected