You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix find_free_port to use ephemeral OS-assigned port by default
find_free_port() scanned upward from a hardcoded port 8000, bound a
socket only to test availability, then released it before returning the
number. Under pytest-xdist (-n auto), every worker scanned from 8000 and
picked the same port, then collided when uvicorn actually bound it,
causing SystemExit and nondeterministic test failures in test_lifecycle
and test_interface.
The default no-arg call (used by ChartServer/run_server) now binds to
ephemeral port 0 and returns the OS-assigned port, which the kernel
guarantees to be unique per process. Explicit-range calls still scan,
preserving existing behaviour and tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments