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

Appearance settings
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions 14 Lib/test/test_asyncio/test_sendfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Tests for sendfile functionality."""

import asyncio
import errno
import os
import socket
import sys
Expand Down Expand Up @@ -484,8 +485,17 @@ def sendfile_native(transp, file, offset, count):

srv_proto, cli_proto = self.prepare_sendfile(close_after=1024)
with self.assertRaises(ConnectionError):
self.run_loop(
self.loop.sendfile(cli_proto.transport, self.file))
try:
self.run_loop(
self.loop.sendfile(cli_proto.transport, self.file))
except OSError as e:
# macOS may raise OSError of EPROTOTYPE when writing to a
# socket that is in the process of closing down.
if e.errno == errno.EPROTOTYPE and sys.platform == "darwin":
raise ConnectionError
else:
raise

self.run_loop(srv_proto.done)

self.assertTrue(1024 <= srv_proto.nbytes < len(self.DATA),
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.