mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-01 07:13:00 +00:00
feat: add crewai-tools workspace and fix tests/dependencies
* feat: add crewai-tools workspace structure * Squashed 'temp-crewai-tools/' content from commit 9bae5633 git-subtree-dir: temp-crewai-tools git-subtree-split: 9bae56339096cb70f03873e600192bd2cd207ac9 * feat: configure crewai-tools workspace package with dependencies * fix: apply ruff auto-formatting to crewai-tools code * chore: update lockfile * fix: don't allow tool tests yet * fix: comment out extra pytest flags for now * fix: remove conflicting conftest.py from crewai-tools tests * fix: resolve dependency conflicts and test issues - Pin vcrpy to 7.0.0 to fix pytest-recording compatibility - Comment out types-requests to resolve urllib3 conflict - Update requests requirement in crewai-tools to >=2.32.0
This commit is contained in:
45
lib/crewai-tools/tests/test_optional_dependencies.py
Normal file
45
lib/crewai-tools/tests/test_optional_dependencies.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def temp_project():
|
||||
temp_dir = tempfile.TemporaryDirectory()
|
||||
project_dir = Path(temp_dir.name) / "test_project"
|
||||
project_dir.mkdir()
|
||||
|
||||
pyproject_content = """
|
||||
[project]
|
||||
name = "test-project"
|
||||
version = "0.1.0"
|
||||
description = "Test project"
|
||||
requires-python = ">=3.10"
|
||||
"""
|
||||
|
||||
(project_dir / "pyproject.toml").write_text(pyproject_content)
|
||||
run_command(
|
||||
["uv", "add", "--editable", f"file://{Path.cwd().absolute()}"], project_dir
|
||||
)
|
||||
run_command(["uv", "sync"], project_dir)
|
||||
yield project_dir
|
||||
|
||||
|
||||
def run_command(cmd, cwd):
|
||||
return subprocess.run(cmd, cwd=cwd, capture_output=True, text=True)
|
||||
|
||||
|
||||
def test_no_optional_dependencies_in_init(temp_project):
|
||||
"""
|
||||
Test that crewai-tools can be imported without optional dependencies.
|
||||
|
||||
The package defines optional dependencies in pyproject.toml, but the base
|
||||
package should be importable without any of these optional dependencies
|
||||
being installed.
|
||||
"""
|
||||
result = run_command(
|
||||
["uv", "run", "python", "-c", "import crewai_tools"], temp_project
|
||||
)
|
||||
assert result.returncode == 0, f"Import failed with error: {result.stderr}"
|
||||
Reference in New Issue
Block a user