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:
Devin AI
2025-08-03 09:05:11 +00:00
parent 8405122051
commit 9f0f668d12

View File

@@ -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):