Address PR review feedback and fix CI failures

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-05-09 02:27:27 +00:00
parent 6db161465b
commit 0f0623d31c
3 changed files with 36 additions and 6 deletions

View File

@@ -1,10 +1,31 @@
"""Tests for Python version compatibility."""
import pytest
import sys
import pytest
from packaging import version
def validate_python_version():
"""Validate that the current Python version is supported."""
min_version = (3, 10)
max_version = (3, 14)
current = sys.version_info[:2]
if not (min_version <= current < max_version):
raise RuntimeError(
f"This package requires Python {min_version[0]}.{min_version[1]} to "
f"{max_version[0]}.{max_version[1]-1}. You have Python {current[0]}.{current[1]}"
)
def test_python_version_compatibility():
"""Test that the package supports the current Python version."""
assert isinstance(sys.version_info, tuple), "Version Information must be a tuple"
current_version = version.parse(f"{sys.version_info.major}.{sys.version_info.minor}")
assert current_version >= version.parse("3.10"), "Python version too old"
assert current_version < version.parse("3.14"), "Python version too new"
# This test will fail if the package doesn't support the current Python version
import crewai
@@ -14,5 +35,5 @@ def test_python_version_compatibility():
# Print the crewai version for debugging
print(f"CrewAI version: {crewai.__version__}")
# If we got here, the import worked, which means the package supports this Python version
assert True
# Validate Python version
validate_python_version()