gh-71052: Add test exclusions to support running the test suite on Android (#115918)

This commit is contained in:
Malcolm Smith 2024-02-29 21:32:50 +00:00 committed by GitHub
parent 83c5ecdeec
commit 41d5391c55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 58 additions and 27 deletions

View file

@ -198,6 +198,23 @@ def skip_unless_symlink(test):
return test if ok else unittest.skip(msg)(test)
_can_hardlink = None
def can_hardlink():
global _can_hardlink
if _can_hardlink is None:
# Android blocks hard links using SELinux
# (https://stackoverflow.com/q/32365690).
_can_hardlink = hasattr(os, "link") and not support.is_android
return _can_hardlink
def skip_unless_hardlink(test):
ok = can_hardlink()
msg = "requires hardlink support"
return test if ok else unittest.skip(msg)(test)
_can_xattr = None