Add in_process mode to prefect_test_harness to avoid VCR/httpcore hangs
When using prefect_test_harness with HTTP mocking libraries like VCR/vcrpy,
nested subflows can hang due to httpcore.PoolTimeout. This happens because
VCR wraps httpcore's connection handling and doesn't properly release
connections between subflows.
This adds an `in_process=True` option that runs the Prefect server in-process
using ASGI transport instead of starting a subprocess HTTP server. This
completely bypasses HTTP connection pooling, avoiding the VCR issue.
Historical context: The subprocess server was introduced in PR #14722 to
support WebSockets (required for events). The in-memory ASGI approach doesn't
support WebSockets, so this new option is opt-in for backwards compatibility.
The implementation uses a ContextVar to avoid backwards imports - testing
utilities import from client code, not vice versa.
Fixes: pydantic/pydantic-ai#3929
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Refactor tests to use module-level imports
Move imports to module level since the fix ensures StateDetails is
properly rebuilt at import time. The subprocess test still uses inline
imports because it must test a fresh Python process.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
feat: Upserting global concurrency limit decay
Add the ability to upsert the slot_decay_per_second using the
client's upsert_global_concurrency_limit_by_name method
Rewrite tests to use real API instead of mocking
- Use prefect_client fixture to create real automations in test DB
- Use run_sync_in_worker_thread for invoke_and_assert in async tests
- Handle 404 error gracefully when automation not found
- Add proper imports for AutomationCore and run_sync_in_worker_thread
Co-Authored-By: Nate Nowack <nate@prefect.io>