diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-02-24 06:14:15 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-02-24 06:14:15 (GMT) |
commit | 510addf63f484da826ad1886c4ed14f6395e4018 (patch) | |
tree | 0635c541d2a486e3db6143f9407bebc0c6611e0b /Lib/test/test_socketserver.py | |
parent | 150ea1a1dffd624b4cd6c2608ece249d12588907 (diff) | |
parent | 1827eff03087d0e7975806967a68a349e10e5188 (diff) | |
download | cpython-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.py | 41 |
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): |