summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
diff options
context:
space:
mode:
authorXavier de Gaye <xdegaye@users.sourceforge.net>2016-12-13 09:00:01 (GMT)
committerXavier de Gaye <xdegaye@users.sourceforge.net>2016-12-13 09:00:01 (GMT)
commit3a4e989324cc1f75c9f749c9e1c20de2f43df6e3 (patch)
tree909f3c636598c4ec5a76916801cb91861ded71ce /Lib/test/support
parentfb24eead481a00c9bb86c436461971790fce7937 (diff)
downloadcpython-3a4e989324cc1f75c9f749c9e1c20de2f43df6e3.zip
cpython-3a4e989324cc1f75c9f749c9e1c20de2f43df6e3.tar.gz
cpython-3a4e989324cc1f75c9f749c9e1c20de2f43df6e3.tar.bz2
Issue #28759: Fix the tests that fail with PermissionError when run as
a non-root user on Android where access rights are controled by SELinux MAC.
Diffstat (limited to 'Lib/test/support')
-rw-r--r--Lib/test/support/__init__.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 1a38c4a..ed1af2b 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -93,7 +93,7 @@ __all__ = [
"check__all__", "requires_android_level", "requires_multiprocessing_queue",
# sys
"is_jython", "is_android", "check_impl_detail", "unix_shell",
- "setswitchinterval",
+ "setswitchinterval", "android_not_root",
# network
"HOST", "IPV6_ENABLED", "find_unused_port", "bind_port", "open_urlresource",
# processes
@@ -769,6 +769,7 @@ is_jython = sys.platform.startswith('java')
_ANDROID_API_LEVEL = sysconfig.get_config_var('ANDROID_API_LEVEL')
is_android = (_ANDROID_API_LEVEL is not None and _ANDROID_API_LEVEL > 0)
+android_not_root = (is_android and os.geteuid() != 0)
if sys.platform != 'win32':
unix_shell = '/system/bin/sh' if is_android else '/bin/sh'