fix: address flaky tests (#3363)
Some checks failed
Notify Downstream / notify-downstream (push) Has been cancelled

fix: resolve flaky tests and race conditions in test suite

- Fix telemetry/event tests by patching class methods instead of instances
- Use unique temp files/directories to prevent CI race conditions
- Reset singleton state between tests
- Mock embedchain.Client.setup() to prevent JSON corruption
- Rename test files to test_*.py convention
- Move agent tests to tests/agents directory
- Fix repeated tool usage detection
- Remove database-dependent tools causing initialization errors
This commit is contained in:
Greyson LaLonde
2025-08-20 13:34:09 -04:00
committed by GitHub
parent 7fdf9f9290
commit 641c156c17
35 changed files with 670 additions and 527 deletions

View File

@@ -108,7 +108,9 @@ class TestValidateToken(unittest.TestCase):
class TestTokenManager(unittest.TestCase):
def setUp(self):
@patch("crewai.cli.authentication.utils.TokenManager._get_or_create_key")
def setUp(self, mock_get_key):
mock_get_key.return_value = Fernet.generate_key()
self.token_manager = TokenManager()
@patch("crewai.cli.authentication.utils.TokenManager.read_secure_file")