Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1827eff0
Commit
1827eff0
authored
Feb 24, 2016
by
Martin Panter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #5824: Fix DatagramRequestHandler tests by binding the client socket
parent
ee3074e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
29 deletions
+20
-29
Lib/socketserver.py
Lib/socketserver.py
+0
-8
Lib/test/test_socketserver.py
Lib/test/test_socketserver.py
+20
-21
No files found.
Lib/socketserver.py
View file @
1827eff0
...
...
@@ -120,11 +120,6 @@ BaseServer:
# Author of the BaseServer patch: Luke Kenneth Casson Leighton
# XXX Warning!
# There is a test suite for this module, but it cannot be run by the
# standard regression test.
# To run it manually, run Lib/test/test_socketserver.py.
__version__
=
"0.4"
...
...
@@ -750,9 +745,6 @@ class StreamRequestHandler(BaseRequestHandler):
class
DatagramRequestHandler
(
BaseRequestHandler
):
# XXX Regrettably, I cannot get this working on Linux;
# s.recvfrom() doesn't return a meaningful client address.
"""Define self.rfile and self.wfile for datagram sockets."""
def
setup
(
self
):
...
...
Lib/test/test_socketserver.py
View file @
1827eff0
...
...
@@ -160,6 +160,8 @@ class SocketServerTest(unittest.TestCase):
def
dgram_examine
(
self
,
proto
,
addr
):
s
=
socket
.
socket
(
proto
,
socket
.
SOCK_DGRAM
)
if
HAVE_UNIX_SOCKETS
and
proto
==
socket
.
AF_UNIX
:
s
.
bind
(
self
.
pickaddr
(
proto
))
s
.
sendto
(
TEST_STR
,
addr
)
buf
=
data
=
receive
(
s
,
100
)
while
data
and
b'
\
n
'
not
in
buf
:
...
...
@@ -222,27 +224,24 @@ class SocketServerTest(unittest.TestCase):
socketserver
.
DatagramRequestHandler
,
self
.
dgram_examine
)
# Alas, on Linux (at least) recvfrom() doesn't return a meaningful
# client address so this cannot work:
# @requires_unix_sockets
# def test_UnixDatagramServer(self):
# self.run_server(socketserver.UnixDatagramServer,
# socketserver.DatagramRequestHandler,
# self.dgram_examine)
#
# @requires_unix_sockets
# def test_ThreadingUnixDatagramServer(self):
# self.run_server(socketserver.ThreadingUnixDatagramServer,
# socketserver.DatagramRequestHandler,
# self.dgram_examine)
#
# @requires_unix_sockets
# @requires_forking
# def test_ForkingUnixDatagramServer(self):
# self.run_server(socketserver.ForkingUnixDatagramServer,
# socketserver.DatagramRequestHandler,
# self.dgram_examine)
@
requires_unix_sockets
def
test_UnixDatagramServer
(
self
):
self
.
run_server
(
socketserver
.
UnixDatagramServer
,
socketserver
.
DatagramRequestHandler
,
self
.
dgram_examine
)
@
requires_unix_sockets
def
test_ThreadingUnixDatagramServer
(
self
):
self
.
run_server
(
socketserver
.
ThreadingUnixDatagramServer
,
socketserver
.
DatagramRequestHandler
,
self
.
dgram_examine
)
@
requires_unix_sockets
@
requires_forking
def
test_ForkingUnixDatagramServer
(
self
):
self
.
run_server
(
ForkingUnixDatagramServer
,
socketserver
.
DatagramRequestHandler
,
self
.
dgram_examine
)
@
reap_threads
def
test_shutdown
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment