There was an error while loading. Please reload this page.
1 parent 0d32864 commit ad3e684Copy full SHA for ad3e684
1 file changed
Lib/test/support/os_helper.py
@@ -198,6 +198,24 @@ def skip_unless_symlink(test):
198
return test if ok else unittest.skip(msg)(test)
199
200
201
+_can_hardlink = None
202
+
203
204
+def can_hardlink():
205
+ global _can_hardlink
206
+ if _can_hardlink is None:
207
+ # Android blocks hard links using SELinux
208
+ # (https://stackoverflow.com/q/32365690).
209
+ _can_hardlink = hasattr(os, "link") and not support.is_android
210
+ return _can_hardlink
211
212
213
+def skip_unless_hardlink(test):
214
+ ok = can_hardlink()
215
+ msg = "requires hardlink support"
216
+ return test if ok else unittest.skip(msg)(test)
217
218
219
_can_xattr = None
220
221
0 commit comments