From d7d4fea4a39da4bfdea1de22fe040023eb4ddc17 Mon Sep 17 00:00:00 2001 From: xdegaye Date: Sun, 12 Nov 2017 18:02:06 +0100 Subject: [PATCH] bpo-29181: Skip test_tarfile tests on PermissionError raised by Android (GH-4375) --- Lib/test/test_tarfile.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index f0a5b21ab5..179cbc6dff 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -1147,7 +1147,10 @@ class WriteTest(WriteTestBase, unittest.TestCase): target = os.path.join(TEMPDIR, "link_target") with open(target, "wb") as fobj: fobj.write(b"aaa") - os.link(target, link) + try: + os.link(target, link) + except PermissionError as e: + self.skipTest('os.link(): %s' % e) try: tar = tarfile.open(tmpname, self.mode) try: @@ -1609,7 +1612,10 @@ class HardlinkTest(unittest.TestCase): with open(self.foo, "wb") as fobj: fobj.write(b"foo") - os.link(self.foo, self.bar) + try: + os.link(self.foo, self.bar) + except PermissionError as e: + self.skipTest('os.link(): %s' % e) self.tar = tarfile.open(tmpname, "w") self.tar.add(self.foo) -- 2.40.0