Title: [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user
Type: behavior Stage: patch review
Components: asyncio, Tests Versions: Python 3.7, Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: haypo, xdegaye, yselivanov
Priority: normal Keywords: patch

Created on 2016-11-13 20:39 by xdegaye, last changed 2016-11-17 21:25 by giampaolo.rodola.

File name Uploaded Description Edit
test_asyncio.log xdegaye, 2016-11-13 20:39
test_asyncio_bind.patch xdegaye, 2016-11-17 12:45 review
Messages (3)
msg280714 - (view) Author: Xavier de Gaye (xdegaye) * (Python committer) Date: 2016-11-13 20:39
Tests in test_asyncio fail on Android when bind() on a unix socket raises PermissionError for a non-root user. See the attached test_asyncio.log. See also issue 28683 and its patch(es).
msg280769 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2016-11-14 13:03
I suggest to write a decorator in Lib/asyncio/ to skip AF_UNIX tests on Android if os.getuid() != 0.

Another approach is to catch the PermissionError and re-raises an unittest.SkipTest. Begin by modifying unix_socket_path() context manager in Lib/asyncio/

I prefer the approach catching PermissionError: it allows to run unit tests on a flavor of Android which doesn't raise PermissionError, and it handles PermissionError on other platforms.
msg281038 - (view) Author: Xavier de Gaye (xdegaye) * (Python committer) Date: 2016-11-17 12:45
With this patch, test_asyncio runs successfully with no ResourceWarning when run on the android-24 emulator.
Date User Action Args
2016-11-21 15:40:04xdegayelinkissue26865 dependencies
2016-11-17 21:25:12giampaolo.rodolasetnosy: - giampaolo.rodola
2016-11-17 21:24:27gvanrossumsetnosy: - gvanrossum
2016-11-17 12:45:48xdegayesetfiles: + test_asyncio_bind.patch
keywords: + patch
messages: + msg281038

stage: needs patch -> patch review
2016-11-14 13:03:52hayposetmessages: + msg280769
2016-11-13 20:39:34xdegayecreate