mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 16:48:30 +00:00
fix: use simpler exception assertion for Python 3.10 compatibility
- Replace pytest.raises match parameter with exc_info and string assertion - Avoids potential regex matching differences between Python versions - Should resolve Python 3.10 CI test failure while maintaining test effectiveness Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -86,8 +86,10 @@ def test_environment_variable_file_not_found(monkeypatch):
|
|||||||
"""Test proper error handling when environment variable points to non-existent file"""
|
"""Test proper error handling when environment variable points to non-existent file"""
|
||||||
monkeypatch.setenv("CREWAI_I18N_FILE", "/nonexistent/file.json")
|
monkeypatch.setenv("CREWAI_I18N_FILE", "/nonexistent/file.json")
|
||||||
|
|
||||||
with pytest.raises(Exception, match="Prompt file '/nonexistent/file.json' not found"):
|
with pytest.raises(Exception) as exc_info:
|
||||||
I18N()
|
I18N()
|
||||||
|
|
||||||
|
assert "Prompt file '/nonexistent/file.json' not found" in str(exc_info.value)
|
||||||
|
|
||||||
|
|
||||||
def test_fallback_to_default_when_no_environment_variable(monkeypatch):
|
def test_fallback_to_default_when_no_environment_variable(monkeypatch):
|
||||||
|
|||||||
Reference in New Issue
Block a user