summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socketserver.py
diff options
context:
space:
mode:
authorxdegaye <xdegaye@gmail.com>2017-11-18 17:10:53 (GMT)
committerGitHub <noreply@github.com>2017-11-18 17:10:53 (GMT)
commit9001d1f438e968f4d327313e0a95a49f22e724f4 (patch)
tree63aec438caa533ee7ffe1d631f97835eb0c78aad /Lib/test/test_socketserver.py
parent51d546ae4d563fde608e23c9c337fefd7e95c93f (diff)
downloadcpython-9001d1f438e968f4d327313e0a95a49f22e724f4.zip
cpython-9001d1f438e968f4d327313e0a95a49f22e724f4.tar.gz
cpython-9001d1f438e968f4d327313e0a95a49f22e724f4.tar.bz2
bpo-29184: Skip test_socketserver tests on PermissionError raised by Android (GH-4387)
Diffstat (limited to 'Lib/test/test_socketserver.py')
-rw-r--r--Lib/test/test_socketserver.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index a23373f..6584ba5 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -60,10 +60,14 @@ def simple_subprocess(testcase):
if pid == 0:
# Don't raise an exception; it would be caught by the test harness.
os._exit(72)
- yield None
- pid2, status = os.waitpid(pid, 0)
- testcase.assertEqual(pid2, pid)
- testcase.assertEqual(72 << 8, status)
+ try:
+ yield None
+ except:
+ raise
+ finally:
+ pid2, status = os.waitpid(pid, 0)
+ testcase.assertEqual(pid2, pid)
+ testcase.assertEqual(72 << 8, status)
class SocketServerTest(unittest.TestCase):
@@ -108,7 +112,12 @@ class SocketServerTest(unittest.TestCase):
self.wfile.write(line)
if verbose: print("creating server")
- server = MyServer(addr, MyHandler)
+ try:
+ server = MyServer(addr, MyHandler)
+ except PermissionError as e:
+ # Issue 29184: cannot bind() a Unix socket on Android.
+ self.skipTest('Cannot create server (%s, %s): %s' %
+ (svrcls, addr, e))
self.assertEqual(server.server_address, server.socket.getsockname())
return server