GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-70765: fix an HTTP/0.9 flaky test post GH-139514 (#139610) · openSUSE-Python/cpython@1998134

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Lib/test
    • test_httpservers.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Lib/test/test_httpservers.py‎

Copy file name to clipboardExpand all lines: Lib/test/test_httpservers.py
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,13 @@ def test_single_request(self):
391391
res = self.sock.recv(1024)
392392
self.assertEqual(res, b"OK: here is /foo.html\r\n")
393393

394-
self.sock.send(b'GET /bar.html\r\n')
395-
res = self.sock.recv(1024)
396-
# The server will not parse more input as it closed the connection.
397-
# Note that the socket connection itself is still opened since the
398-
# client is responsible for also closing it on their side.
399-
self.assertEqual(res, b'')
394+
# Ignore errors if the connection is already closed,
395+
# as this is the expected behavior of HTTP/0.9.
396+
with contextlib.suppress(OSError):
397+
self.sock.send(b'GET /bar.html\r\n')
398+
res = self.sock.recv(1024)
399+
# The server should not process our request.
400+
self.assertEqual(res, b'')
400401

401402

402403
def certdata_file(*path):

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.