summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socketserver.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-02-24 06:14:15 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-02-24 06:14:15 (GMT)
commit510addf63f484da826ad1886c4ed14f6395e4018 (patch)
tree0635c541d2a486e3db6143f9407bebc0c6611e0b /Lib/test/test_socketserver.py
parent150ea1a1dffd624b4cd6c2608ece249d12588907 (diff)
parent1827eff03087d0e7975806967a68a349e10e5188 (diff)
downloadcpython-510addf63f484da826ad1886c4ed14f6395e4018.zip
cpython-510addf63f484da826ad1886c4ed14f6395e4018.tar.gz
cpython-510addf63f484da826ad1886c4ed14f6395e4018.tar.bz2
Issue #5824: Merge socketserver tests from 3.5
Diffstat (limited to 'Lib/test/test_socketserver.py')
-rw-r--r--Lib/test/test_socketserver.py41
1 files changed, 20 insertions, 21 deletions
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index bff0ff4..27fe01c 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -161,6 +161,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:
@@ -223,27 +225,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):