diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2017-02-01 22:38:12 +0300 |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2017-02-01 22:38:12 +0300 |
commit | b64c0079822007c7846e7d3eb6e6f6b5d82d3a03 (patch) | |
tree | 61860585c5d1c1e62275cdc449be5d7494c143b8 /Lib/test/support/__init__.py | |
parent | a706118dafc16edfed490c53db02c08aefe7b097 (diff) | |
parent | 0e4701169a3e3a022f03997399d04d28ca90c620 (diff) | |
download | cpython-b64c0079822007c7846e7d3eb6e6f6b5d82d3a03.tar.gz |
Issue #29407: Merge from 3.6
Diffstat (limited to 'Lib/test/support/__init__.py')
-rw-r--r-- | Lib/test/support/__init__.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 15d8fc849b..345e16d754 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -777,8 +777,13 @@ requires_lzma = unittest.skipUnless(lzma, 'requires lzma') 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) +try: + # constant used by requires_android_level() + _ANDROID_API_LEVEL = sys.getandroidapilevel() + is_android = True +except AttributeError: + # sys.getandroidapilevel() is only available on Android + is_android = False android_not_root = (is_android and os.geteuid() != 0) if sys.platform != 'win32': |