mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-01 21:28:10 +00:00
Update crewAI CLI with various enhancements and fixes
- Updated `create_json_crew.py` to require `crewai[tools]>=1.14.7`. - Enhanced `git.py` with improved repository initialization, including automatic initial commit creation and exclusion patterns for initial commits. - Modified `install_crew.py` to allow error handling during installation with an optional `raise_on_error` parameter. - Expanded `plus_api.py` to include methods for creating and updating crews from ZIP files. - Introduced a new `archive.py` for creating deployable ZIP archives of CrewAI projects, ensuring local artifacts are excluded. - Updated `run_crew.py` to manage JSON crew dependencies and run crews in the project's environment. - Enhanced deployment logic in `main.py` to handle ZIP uploads and improve user feedback during deployment processes. - Added tests for new functionalities and ensured existing tests reflect recent changes in behavior and requirements.
This commit is contained in:
@@ -99,3 +99,43 @@ def test_origin_url(fp, repository):
|
||||
stdout="https://github.com/user/repo.git\n",
|
||||
)
|
||||
assert repository.origin_url() == "https://github.com/user/repo.git"
|
||||
|
||||
|
||||
def test_initialize_creates_initial_commit(fp, tmp_path):
|
||||
fp.register(["git", "--version"], stdout="git version 2.30.0\n")
|
||||
fp.register(["git", "init"], stdout="")
|
||||
fp.register(["git", "--version"], stdout="git version 2.30.0\n")
|
||||
fp.register(["git", "rev-parse", "--is-inside-work-tree"], stdout="true\n")
|
||||
fp.register(["git", "rev-parse", "--verify", "HEAD"], returncode=1)
|
||||
fp.register(["git", "add", "."], stdout="")
|
||||
fp.register(
|
||||
[
|
||||
"git",
|
||||
"-c",
|
||||
"user.name=CrewAI",
|
||||
"-c",
|
||||
"user.email=deploy@crewai.com",
|
||||
"commit",
|
||||
"--allow-empty",
|
||||
"-m",
|
||||
"Initial crew",
|
||||
],
|
||||
stdout="",
|
||||
)
|
||||
|
||||
repo = Repository.initialize(path=str(tmp_path))
|
||||
|
||||
assert repo.path == str(tmp_path)
|
||||
exclude_file = tmp_path / ".git" / "info" / "exclude"
|
||||
exclude_text = exclude_file.read_text()
|
||||
assert ".env" in exclude_text
|
||||
assert "__pycache__/" in exclude_text
|
||||
|
||||
|
||||
def test_deployable_files_uses_git_excludes(fp, repository):
|
||||
fp.register(
|
||||
["git", "ls-files", "--cached", "--others", "--exclude-standard"],
|
||||
stdout="pyproject.toml\nsrc/main.py\n",
|
||||
)
|
||||
|
||||
assert repository.deployable_files() == ["pyproject.toml", "src/main.py"]
|
||||
|
||||
Reference in New Issue
Block a user