Commit 9001d1f4 authored by xdegaye's avatar xdegaye Committed by GitHub

bpo-29184: Skip test_socketserver tests on PermissionError raised by Android (GH-4387)

parent 51d546ae
...@@ -60,10 +60,14 @@ def simple_subprocess(testcase): ...@@ -60,10 +60,14 @@ def simple_subprocess(testcase):
if pid == 0: if pid == 0:
# Don't raise an exception; it would be caught by the test harness. # Don't raise an exception; it would be caught by the test harness.
os._exit(72) os._exit(72)
yield None try:
pid2, status = os.waitpid(pid, 0) yield None
testcase.assertEqual(pid2, pid) except:
testcase.assertEqual(72 << 8, status) raise
finally:
pid2, status = os.waitpid(pid, 0)
testcase.assertEqual(pid2, pid)
testcase.assertEqual(72 << 8, status)
class SocketServerTest(unittest.TestCase): class SocketServerTest(unittest.TestCase):
...@@ -108,7 +112,12 @@ class SocketServerTest(unittest.TestCase): ...@@ -108,7 +112,12 @@ class SocketServerTest(unittest.TestCase):
self.wfile.write(line) self.wfile.write(line)
if verbose: print("creating server") 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()) self.assertEqual(server.server_address, server.socket.getsockname())
return server return server
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment