Fix test_server.py for Python 3.14: robust IPv4 binding and error surfacing#352
Fix test_server.py for Python 3.14: robust IPv4 binding and error surfacing#352
Conversation
…r queue Co-authored-by: aszs <626790+aszs@users.noreply.github.com>
Co-authored-by: aszs <626790+aszs@users.noreply.github.com>
|
@copilot this PR should be applied against the testing branch not main |
I'm unable to change the PR's base branch setting directly. You can change the target branch from |
Co-authored-by: aszs <626790+aszs@users.noreply.github.com>
I verified the current state of |
|
@copilot ok, i see -- why does it say "This branch has conflicts that must be resolved" and when i click on "resolve conflicts" the web editor shows 21 conflicts? |
The conflicts are showing because this PR is targeting |
|
@copilot hmm I did that already but conflicts are still there. Can you make a new PR against testing reapplying the changes you made in this PR to the testing branch? |
ac09743 to
1ad7f27
Compare
a4a4a86 to
26b5476
Compare
65c376b to
2aa5505
Compare
8329414 to
1dcaddd
Compare
2920142 to
19af69f
Compare
01b625c to
1ad1e64
Compare
wait_for_statushelper function near top oftests/test_server.pyto poll until expected status code or timeoutassert res.status_code == 304intest_server_export_remotefor the application-blueprint test with call towait_for_statusCombined changes from both PR #352 (robust IPv4 binding and error surfacing) and PR #355 (wait_for_status helper for async cache timing).
Rebased cleanly against
testingbranch.Changes from PR #352:
HOST = "127.0.0.1"constant to avoidgetaddrinforesolution differences across platformsserve_serverwrapper forwards exceptions to amultiprocessing.Queue, enabling parent process to surface actual server crash reasonssocket.create_connectionagainst both IPv4/IPv6, increased timeout from 2s to 12sget_context()and attach error queue to fixture,set_up_deployment,test_server_export_local,test_server_export_remoteHOSTinstead of hardcoded127.0.0.1Changes from PR #355:
assert res.status_code == 304assertions withwait_for_status(expected=304, timeout=15.0)callsOriginal prompt
Problem
The py3.14 CI job is failing with ConnectionRefusedError in tests/test_server.py::test_server_version because the test helper that starts the server (start_server_process) is fragile: it polls only briefly, uses urllib against "localhost" (subject to IPv6/IPv4 resolution differences), and does not surface server-side exceptions when the child process exits. That hides the root cause when the server process crashes or binds to a different address family under Python 3.14.
Goal
Create a PR that makes tests/test_server.py robust so the test harness:
Files to change
Detailed changes to apply
Before (existing pattern):
After:
Do the same in set_up_deployment, test_server_export_local, test_server_export_remote, and other places where Process is used to start server.serve.
Why this change
This pull request was created as a result of the following prompt from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.