mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-10-20 17:05:04 +02:00
`crewai eval` now refuses to run the crew whenever a credential of this machine would go with the trace to an AMP it does not trust, whatever the tracing setting: `tracing=True` in code is invisible to the CLI, and a project's crewai older than the handshake sends the credential wherever the run traces. The run app's Evaluate makes the same check before it asks anything, so a yes can never write CREWAI_TRACING_ENABLED=true to `.env` for a re-run that is then refused. Which credentials are this machine's is read from the environment as it was before any project `.env` was loaded (`run_crew.environment_before_project`), so on Evaluate's re-run a CREWAI_USER_PAT the project's own `.env` brought is the project's, as on any run of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
877 B
Python
24 lines
877 B
Python
"""Shared setup for the CLI's tests."""
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _usage_counts_stay_on_this_machine(monkeypatch):
|
|
"""The CLI counts what its commands do (`cli_usage:*`), and a suite that
|
|
exercises them would send those counts as if users had run them: every
|
|
`crewai eval` stop reason within the same second, from a laptop or from CI.
|
|
A test that checks the counting replaces `Telemetry` or sets the flag
|
|
itself."""
|
|
monkeypatch.setenv("CREWAI_DISABLE_TELEMETRY", "true")
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _each_test_starts_before_any_project_env(monkeypatch):
|
|
"""`load_project_env` remembers what a project's `.env` replaced, for the
|
|
life of the process; a test's `.env` must not become the next test's
|
|
"before"."""
|
|
from crewai_cli import run_crew
|
|
|
|
monkeypatch.setattr(run_crew, "_ENV_BEFORE_PROJECT", {})
|