Skip to content

Conversation

@evalstate
Copy link
Owner

…xtures

This commit improves integration test performance by reducing FastAgent instance creation overhead. The main optimization is implementing module-scoped fixtures for FastAgent instances, which significantly reduces test execution time.

Key changes:

  1. Module-scoped FastAgent fixtures (conftest.py):

    • Added fast_agent_module, markup_fast_agent_module, and auto_sampling_off_fast_agent_module fixtures
    • These create a single FastAgent instance per test module
    • Function-scoped wrappers (fast_agent, markup_fast_agent, auto_sampling_off_fast_agent) reuse the module-scoped instances
    • AsyncEventBus cleanup (autouse fixture) ensures test isolation
  2. Benefits:

    • Reduces FastAgent initialization from 38+ times to ~11-13 times
    • Avoids repeated config loading and MCP server initialization
    • Expected speedup: 2-3x for API integration tests
    • Maintains test isolation through AsyncEventBus reset
  3. ACP tests remain unchanged:

    • ACP subprocess tests continue to spawn per-test (37 tests)
    • Module-scoped async fixtures were too complex with pytest-asyncio
    • Per-test isolation is more important for subprocess tests
  4. Linting fixes:

    • Removed unused pytest_asyncio imports
    • Fixed unused session_id variables in filesystem tests

All integration tests pass with these changes.

…xtures

This commit improves integration test performance by reducing FastAgent
instance creation overhead. The main optimization is implementing
module-scoped fixtures for FastAgent instances, which significantly
reduces test execution time.

Key changes:

1. Module-scoped FastAgent fixtures (conftest.py):
   - Added fast_agent_module, markup_fast_agent_module, and
     auto_sampling_off_fast_agent_module fixtures
   - These create a single FastAgent instance per test module
   - Function-scoped wrappers (fast_agent, markup_fast_agent,
     auto_sampling_off_fast_agent) reuse the module-scoped instances
   - AsyncEventBus cleanup (autouse fixture) ensures test isolation

2. Benefits:
   - Reduces FastAgent initialization from 38+ times to ~11-13 times
   - Avoids repeated config loading and MCP server initialization
   - Expected speedup: 2-3x for API integration tests
   - Maintains test isolation through AsyncEventBus reset

3. ACP tests remain unchanged:
   - ACP subprocess tests continue to spawn per-test (37 tests)
   - Module-scoped async fixtures were too complex with pytest-asyncio
   - Per-test isolation is more important for subprocess tests

4. Linting fixes:
   - Removed unused pytest_asyncio imports
   - Fixed unused session_id variables in filesystem tests

All integration tests pass with these changes.
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