mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-28 10:09:21 +00:00
fix: resolve lint, test, and review issues
- Replace S101 assert guards with explicit if/raise RuntimeError in benchmark.py and cli.py (3 locations) - Fix test_create_llm_from_env_with_unaccepted_attributes to use DEFAULT_LLM_MODEL with clear=True so the assertion isn't brittle against the hardcoded model name - Add n_iterations loop to _test_new_agents (was unused, now mirrors _train_new_agents iteration pattern) - Consolidate dotenv loading in cli.py and agent_tui.py to use the existing load_env_vars() from utils.py instead of duplicating logic Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,7 @@ from textual.widgets import (
|
||||
)
|
||||
|
||||
from crewai_cli.create_agent import _strip_jsonc
|
||||
from crewai_cli.utils import load_env_vars
|
||||
|
||||
|
||||
try:
|
||||
@@ -1703,18 +1704,9 @@ class AgentTUI(App[None]):
|
||||
|
||||
def _load_dotenv(base: Path) -> None:
|
||||
"""Load .env file into os.environ if it exists."""
|
||||
env_path = base / ".env"
|
||||
if not env_path.exists():
|
||||
return
|
||||
try:
|
||||
for line in env_path.read_text(encoding="utf-8").splitlines():
|
||||
line = line.strip()
|
||||
if not line or line.startswith("#"):
|
||||
continue
|
||||
key, _, value = line.partition("=")
|
||||
key = key.strip()
|
||||
value = value.strip()
|
||||
if key and value and key not in os.environ:
|
||||
for key, value in load_env_vars(base).items():
|
||||
if key not in os.environ:
|
||||
os.environ[key] = value
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user