Skip to content

Conversation

@allenday
Copy link

@allenday allenday commented Feb 1, 2025

Improve LLM API Test Suite

Enhances the test suite to better handle LLM API configurations and failures, making it easier for contributors to understand why tests are skipped or failing.

Changes

  1. Add smart API key validation

    • Detect unconfigured or example API keys from .env.example
    • Skip tests appropriately with informative messages
    • Centralize key validation logic in test_utils.py
  2. Improve live test reliability

    • Add graceful error handling for API failures
    • Convert API errors to skipped tests rather than failures
    • Consolidate response assertions into helper method
  3. Better developer experience

    • Update README to document verbose test output
    • Add clear messages about why tests were skipped
    • Clean up duplicate code in test files

Testing

Verified by running test suite with:

  • No .env file (tests properly skipped)
  • .env with example values (tests properly skipped)
  • .env with invalid API keys (graceful error handling)
  • .env with valid API keys (tests pass)

Usage

Run tests with:

PYTHONPATH=. pytest -v tests/

The -v flag shows detailed output including why tests were skipped.

grapeot and others added 3 commits January 23, 2025 22:08
- Add test_utils.py with smart detection of unconfigured/example API keys
- Add graceful error handling for API failures in live tests
- Consolidate test assertions into helper method
- Update README to document verbose test output
- Clean up duplicate code in test files

This improves the testing experience by:
1. Skipping tests when API keys are missing or using example values
2. Converting API errors to skipped tests rather than failures
3. Providing clear messages about why tests were skipped
4. Making test output more informative with -v flag
@grapeot
Copy link
Owner

grapeot commented Feb 2, 2025

Thanks for the PR! I think it's a great improvement to the current testing suite!

@grapeot grapeot merged commit 27b706b into grapeot:multi-agent Feb 2, 2025
2 checks passed
ranaroussi added a commit to ranaroussi/devin.cursorrules that referenced this pull request Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants