Record each `crewai run` that create starts. Other commands, such as git, run for real.
(
monkeypatch, returncode: int = 0, interrupts: int = 0
)
| 436 | |
| 437 | |
| 438 | def _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 | |
| 456 | def _create(args: list[str]) -> None: |
no outgoing calls
no test coverage detected