Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-131178: fix SSL tests forhttp.server command-line interface#134279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
picnixz wants to merge15 commits intopython:main
base:main
Choose a base branch
Loading
frompicnixz:patch/httpserver-test-131178

Conversation

picnixz
Copy link
Member

@picnixzpicnixz commentedMay 19, 2025
edited by bedevere-appbot
Loading

This is a fresh PR because I don't know why GHA is stuck. Locally it works, and I don't know why it now fails remotely.

ggqlq reacted with heart emoji
@picnixz
Copy link
MemberAuthor

Ok, so the tests hang on macOS & Windows for some reason I'm not aware of. The tests are really more E2E tests but they can help catching possible issues so I'm keeping them.

@picnixz
Copy link
MemberAuthor

!buildbot ASAN

@picnixz
Copy link
MemberAuthor

picnixz commentedMay 19, 2025
edited
Loading

Ok, since the build bots are struggling, I'll first remove the bits where we test the HTTP server. I'll try to see how we can reliably test this component later (I'm essentially applyingPEP-11 recommendations when a Tier-1 bot is failing).

@picnixzpicnixz marked this pull request as draftMay 19, 2025 22:30
@picnixz
Copy link
MemberAuthor

picnixz commentedMay 19, 2025
edited
Loading

Ha!

0:11:22 load avg: 11.90 [1/2/1] test_httpservers failed (2 failures)Re-running test_httpservers in verbose mode (matching: test_http_client, test_https_client)test_http_client (test.test_httpservers.CommandLineRunTimeTestCase.test_http_client) ... python -m http.server:  Serving HTTP on :: port 54285 (http://[::]:54285/) ...failed to start HTTP(s) server. Output was: 'Serving HTTP on :: port 54285 (http://[::]:54285/) ...\n'FAILtest_https_client (test.test_httpservers.CommandLineRunTimeTestCase.test_https_client) ... python -m http.server:  Traceback (most recent call last):failed to start HTTP(s) server. Output was: 'Traceback (most recent call last):\n'

So there is something happening! I'll continue investigating this. At least, I think I know why it failed on the build bots. Presumably, the address being served was incorrectly parsed for some reason (namely it wasn't 127.0.0.1 or there was some exception being raised that I wasn't aware of)

@picnixz
Copy link
MemberAuthor

!buildbot ASAN

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@picnixz for commitf735ee5 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F134279%2Fmerge

The command will test the builders whose names match following regular expression:ASAN

The builders matched are:

  • AMD64 Arch Linux Asan PR
  • x86-64 MacOS Intel ASAN NoGIL PR
  • AMD64 Arch Linux Asan Debug PR

@picnixzpicnixz marked this pull request as ready for reviewMay 20, 2025 01:05
@ggqlq
Copy link
Contributor

ggqlq commentedMay 23, 2025
edited
Loading

I tried to reproduce these problems locally based on the commit that cause the buildbot failed(commit hash605022a) and It appears that both of theAttributeError: 'NoneType' object has no attribute 'create_default_context' andAssertionError: False is not true issues mentioned in PR#134224 stem from running ssl in an environment that is missing thessl module build. The server process intest_https_client will exit prematurely due to the missingssl module and print the error traceback. Theproc.stdout.readline() loop in thewait_for_server function will never find the server startup message because the output contains only the error traceback and the function returnsFalse after timeout. The assertionself.assertTrue(wait_for_server(...)) fails withAssertionError: False is not true, while the subsequentfetch_file call will never reach SSL context operation that throwAttributeError, it explains whytest_http_client andtest_https_client failed with different reasons. I think both of the runtime tests failed are related to my mistake that I didn't check thessl module build in PR#132540 and not due to specific environment, I think this PR have already fixed them by adding theskipIf(ssl is None) decorator.

Here's my reproduction of these bugs

  • CPU: AMD64
  • OS: Debian 12
$ git reset --hard 605022aeb69ae19cae1c020a6993ab5c433ce907$ ./configure --with-openssl=donotexist# ...$ make -j12# ...Could not build the ssl module!Python requires a OpenSSL 1.1.1 or newer$ ./python -mtest test_httpservers -v# ...======================================================================ERROR: test_http_client (test.test_httpservers.CommandLineRunTimeTestCase.test_http_client)----------------------------------------------------------------------# ...AttributeError:'NoneType' object has no attribute'create_default_context'======================================================================FAIL: test_https_client (test.test_httpservers.CommandLineRunTimeTestCase.test_https_client)----------------------------------------------------------------------# ...AssertionError: False is nottrue----------------------------------------------------------------------

@picnixz
Copy link
MemberAuthor

The proc.stdout.readline() loop in the wait_for_server function will never find the server startup message because the output contains only the error traceback and the function returns False after timeout

Ah thank you! this is something I couldn't understand as I couldn't show the traceback in full. Thank you very much for that.

@picnixz
Copy link
MemberAuthor

Actually, there is something else. The errors were:

FAIL:test_https_client (test.test_httpservers.CommandLineRunTimeTestCase.test_https_client)----------------------------------------------------------------------Traceback (mostrecentcalllast):File"/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-intel-aws.macos-with-brew.asan.nogil/build/Lib/test/test_httpservers.py",line1533,intest_https_clientself.assertTrue(self.wait_for_server(proc,'https',port,bind))~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError:Falseisnottrue

However, I've already disabled the test ifssl is None, soFalse is being returned for another reason, not because of missingssl.

@picnixz
Copy link
MemberAuthor

!buildbot x86-64 MacOS Intel

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@picnixz for commit7686f3a 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F134279%2Fmerge

The command will test the builders whose names match following regular expression:x86-64 MacOS Intel

The builders matched are:

  • x86-64 MacOS Intel NoGIL PR
  • x86-64 MacOS Intel ASAN NoGIL PR

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
awaiting core reviewskip newstestsTests in the Lib/test dir
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@picnixz@bedevere-bot@ggqlq

[8]ページ先頭

©2009-2025 Movatter.jp