summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_shutil.py
diff options
context:
space:
mode:
authorxdegaye <xdegaye@gmail.com>2017-11-12 17:18:36 (GMT)
committerGitHub <noreply@github.com>2017-11-12 17:18:36 (GMT)
commitad004f9b5a581f577374c56d8ab27e9ef2e73452 (patch)
tree1c31cf59d51e1e257b30efe32ed5a42e2182f082 /Lib/test/test_shutil.py
parentea5b545e38b3fec7ff29276b5cd59dec583ebf34 (diff)
downloadcpython-ad004f9b5a581f577374c56d8ab27e9ef2e73452.zip
cpython-ad004f9b5a581f577374c56d8ab27e9ef2e73452.tar.gz
cpython-ad004f9b5a581f577374c56d8ab27e9ef2e73452.tar.bz2
[3.6] bpo-28759: Skip some tests on PermissionError raised by Android (GH-4350) (#4380)
(cherry picked from commit 92c2ca7633c881a56157f2fb8b2e1b8c7114e5fb)
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r--Lib/test/test_shutil.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index b2ab1af..95717a4 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -23,8 +23,7 @@ import zipfile
import warnings
from test import support
-from test.support import (TESTFN, check_warnings, captured_stdout,
- android_not_root)
+from test.support import TESTFN, check_warnings, captured_stdout
TESTFN2 = TESTFN + "2"
@@ -771,7 +770,6 @@ class TestShutil(unittest.TestCase):
@unittest.skipIf(os.name == 'nt', 'temporarily disabled on Windows')
@unittest.skipUnless(hasattr(os, 'link'), 'requires os.link')
- @unittest.skipIf(android_not_root, "hard links not allowed, non root user")
def test_dont_copy_file_onto_link_to_itself(self):
# bug 851123.
os.mkdir(TESTFN)
@@ -780,7 +778,10 @@ class TestShutil(unittest.TestCase):
try:
with open(src, 'w') as f:
f.write('cheddar')
- os.link(src, dst)
+ try:
+ os.link(src, dst)
+ except PermissionError as e:
+ self.skipTest('os.link(): %s' % e)
self.assertRaises(shutil.SameFileError, shutil.copyfile, src, dst)
with open(src, 'r') as f:
self.assertEqual(f.read(), 'cheddar')
@@ -824,9 +825,11 @@ class TestShutil(unittest.TestCase):
# Issue #3002: copyfile and copytree block indefinitely on named pipes
@unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()')
- @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user")
def test_copyfile_named_pipe(self):
- os.mkfifo(TESTFN)
+ try:
+ os.mkfifo(TESTFN)
+ except PermissionError as e:
+ self.skipTest('os.mkfifo(): %s' % e)
try:
self.assertRaises(shutil.SpecialFileError,
shutil.copyfile, TESTFN, TESTFN2)
@@ -835,7 +838,6 @@ class TestShutil(unittest.TestCase):
finally:
os.remove(TESTFN)
- @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user")
@unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()')
@support.skip_unless_symlink
def test_copytree_named_pipe(self):
@@ -844,7 +846,10 @@ class TestShutil(unittest.TestCase):
subdir = os.path.join(TESTFN, "subdir")
os.mkdir(subdir)
pipe = os.path.join(subdir, "mypipe")
- os.mkfifo(pipe)
+ try:
+ os.mkfifo(pipe)
+ except PermissionError as e:
+ self.skipTest('os.mkfifo(): %s' % e)
try:
shutil.copytree(TESTFN, TESTFN2)
except shutil.Error as e: