bpo-28759: Skip some tests on PermissionError raised by Android (GH-4350)

Access to mkfifo(), mknod() and hard link creation is controled
by SELinux on Android.
Also remove test.support.android_not_root.
This commit is contained in:
xdegaye 2017-11-12 17:31:07 +01:00 committed by GitHub
parent e0582a37c8
commit 92c2ca7633
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 50 additions and 34 deletions

View file

@ -8,7 +8,6 @@ import sys
import unittest
import warnings
from test import support
android_not_root = support.android_not_root
def create_file(filename, data=b'foo'):
@ -213,9 +212,11 @@ class GenericTest:
def test_samefile_on_symlink(self):
self._test_samefile_on_link_func(os.symlink)
@unittest.skipIf(android_not_root, "hard links not allowed, non root user")
def test_samefile_on_link(self):
self._test_samefile_on_link_func(os.link)
try:
self._test_samefile_on_link_func(os.link)
except PermissionError as e:
self.skipTest('os.link(): %s' % e)
def test_samestat(self):
test_fn1 = support.TESTFN
@ -253,9 +254,11 @@ class GenericTest:
def test_samestat_on_symlink(self):
self._test_samestat_on_link_func(os.symlink)
@unittest.skipIf(android_not_root, "hard links not allowed, non root user")
def test_samestat_on_link(self):
self._test_samestat_on_link_func(os.link)
try:
self._test_samestat_on_link_func(os.link)
except PermissionError as e:
self.skipTest('os.link(): %s' % e)
def test_sameopenfile(self):
filename = support.TESTFN