summaryrefslogtreecommitdiffstats
path: root/Lib/test/support/os_helper.py
diff options
context:
space:
mode:
authorMalcolm Smith <smith@chaquo.com>2024-02-29 21:32:50 (GMT)
committerGitHub <noreply@github.com>2024-02-29 21:32:50 (GMT)
commit41d5391c551e2012f13d56ff4bcc1df15c2821d3 (patch)
tree2767dd61f16e8519893a376ce4ec6452661dac16 /Lib/test/support/os_helper.py
parent83c5ecdeec80fbd1f667f234f626c4154d40ebb5 (diff)
downloadcpython-41d5391c551e2012f13d56ff4bcc1df15c2821d3.zip
cpython-41d5391c551e2012f13d56ff4bcc1df15c2821d3.tar.gz
cpython-41d5391c551e2012f13d56ff4bcc1df15c2821d3.tar.bz2
gh-71052: Add test exclusions to support running the test suite on Android (#115918)
Diffstat (limited to 'Lib/test/support/os_helper.py')
-rw-r--r--Lib/test/support/os_helper.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/support/os_helper.py b/Lib/test/support/os_helper.py
index 22787e3..ffa5fc5 100644
--- a/Lib/test/support/os_helper.py
+++ b/Lib/test/support/os_helper.py
@@ -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