diff options
author | Xavier de Gaye <xdegaye@users.sourceforge.net> | 2016-11-13 19:46:46 (GMT) |
---|---|---|
committer | Xavier de Gaye <xdegaye@users.sourceforge.net> | 2016-11-13 19:46:46 (GMT) |
commit | 6c5f21945ad03e1e66328286965219b890eca848 (patch) | |
tree | 1b1ce0522804c12718c15d0188c5ab47ac0642cf /Lib/test/support | |
parent | f056b04eea2363309990916e653704a4c6c10b81 (diff) | |
download | cpython-6c5f21945ad03e1e66328286965219b890eca848.zip cpython-6c5f21945ad03e1e66328286965219b890eca848.tar.gz cpython-6c5f21945ad03e1e66328286965219b890eca848.tar.bz2 |
Fix test_faulthandler on Android where raise() exits with 0
Diffstat (limited to 'Lib/test/support')
-rw-r--r-- | Lib/test/support/__init__.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 8b66f95..961b735 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -90,7 +90,7 @@ __all__ = [ "bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute", "requires_IEEE_754", "skip_unless_xattr", "requires_zlib", "anticipate_failure", "load_package_tests", "detect_api_mismatch", - "check__all__", + "check__all__", "requires_android_level", # sys "is_jython", "is_android", "check_impl_detail", "unix_shell", # network @@ -735,7 +735,8 @@ requires_lzma = unittest.skipUnless(lzma, 'requires lzma') is_jython = sys.platform.startswith('java') -is_android = bool(sysconfig.get_config_var('ANDROID_API_LEVEL')) +_ANDROID_API_LEVEL = sysconfig.get_config_var('ANDROID_API_LEVEL') +is_android = (_ANDROID_API_LEVEL > 0) if sys.platform != 'win32': unix_shell = '/system/bin/sh' if is_android else '/bin/sh' @@ -1725,6 +1726,13 @@ def requires_resource(resource): else: return unittest.skip("resource {0!r} is not enabled".format(resource)) +def requires_android_level(level, reason): + if is_android and _ANDROID_API_LEVEL < level: + return unittest.skip('%s at Android API level %d' % + (reason, _ANDROID_API_LEVEL)) + else: + return _id + def cpython_only(test): """ Decorator for tests only applicable on CPython. |