[Python-checkins] cpython (merge 3.5 -> default): Issue #5824: Merge socketserver tests from 3.5
martin.panter
python-checkins at python.org
Wed Feb 24 01:30:21 EST 2016
https://hg.python.org/cpython/rev/113e9c6fd64d
changeset: 100311:113e9c6fd64d
parent: 100308:5ad27dcd5a97
parent: 100310:0d9d8fdd9736
user: Martin Panter <vadmium+py at gmail.com>
date: Wed Feb 24 06:14:15 2016 +0000
summary:
Issue #5824: Merge socketserver tests from 3.5
files:
Lib/socketserver.py | 8 ----
Lib/test/test_socketserver.py | 39 +++++++++++-----------
2 files changed, 19 insertions(+), 28 deletions(-)
diff --git a/Lib/socketserver.py b/Lib/socketserver.py
--- a/Lib/socketserver.py
+++ b/Lib/socketserver.py
@@ -120,11 +120,6 @@
# 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"
@@ -755,9 +750,6 @@
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):
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -161,6 +161,8 @@
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:
@@ -223,27 +225,24 @@
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_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_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):
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list