Skip to content

Conversation

@eadwinCode
Copy link
Collaborator

After upgrading uvicorn, the test server was failing because uvicorn now calls sys.exit(1) when encountering port binding errors. This caused the entire test process to terminate instead of handling errors gracefully.

Changes:

  • Override startup() method to catch SystemExit exceptions
  • Convert SystemExit to RuntimeError with descriptive message
  • Ensure proper cleanup via lifespan.shutdown() on errors
  • Remove setup_event_loop() call that interfered with running loop
  • Fix _startup_done event synchronization

This allows tests to handle server startup failures properly without terminating the test process.

Fixes socket_io test failures in TestGatewayWithGuards and related test classes.

After upgrading uvicorn, the test server was failing because uvicorn
now calls sys.exit(1) when encountering port binding errors. This
caused the entire test process to terminate instead of handling
errors gracefully.

Changes:
- Override startup() method to catch SystemExit exceptions
- Convert SystemExit to RuntimeError with descriptive message
- Ensure proper cleanup via lifespan.shutdown() on errors
- Remove setup_event_loop() call that interfered with running loop
- Fix _startup_done event synchronization

This allows tests to handle server startup failures properly without
terminating the test process.

Fixes socket_io test failures in TestGatewayWithGuards and related
test classes.
@eadwinCode eadwinCode merged commit 48865be into main Nov 15, 2025
14 checks passed
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.

2 participants