[Python-checkins] bpo-29180: Skip test_os tests on PermissionError raised by Android (GH-4374)

xdegaye webhook-mailer at python.org
Sun Nov 12 11:57:06 EST 2017


https://github.com/python/cpython/commit/6a55d09573e5c35c9e4a24a6f811120b41a2a994
commit: 6a55d09573e5c35c9e4a24a6f811120b41a2a994
branch: master
author: xdegaye <xdegaye at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-11-12T17:57:04+01:00
summary:

bpo-29180: Skip test_os tests on PermissionError raised by Android (GH-4374)

files:
M Lib/test/test_os.py

diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index ff19fac0f77..96ee3ee577f 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -1736,7 +1736,10 @@ def tearDown(self):
     def _test_link(self, file1, file2):
         create_file(file1)
 
-        os.link(file1, file2)
+        try:
+            os.link(file1, file2)
+        except PermissionError as e:
+            self.skipTest('os.link(): %s' % e)
         with open(file1, "r") as f1, open(file2, "r") as f2:
             self.assertTrue(os.path.sameopenfile(f1.fileno(), f2.fileno()))
 
@@ -2888,7 +2891,8 @@ def test_stty_match(self):
         """
         try:
             size = subprocess.check_output(['stty', 'size']).decode().split()
-        except (FileNotFoundError, subprocess.CalledProcessError):
+        except (FileNotFoundError, subprocess.CalledProcessError,
+                PermissionError):
             self.skipTest("stty invocation failed")
         expected = (int(size[1]), int(size[0])) # reversed order
 
@@ -3242,7 +3246,10 @@ def test_attributes(self):
         os.mkdir(dirname)
         filename = self.create_file("file.txt")
         if link:
-            os.link(filename, os.path.join(self.path, "link_file.txt"))
+            try:
+                os.link(filename, os.path.join(self.path, "link_file.txt"))
+            except PermissionError as e:
+                self.skipTest('os.link(): %s' % e)
         if symlink:
             os.symlink(dirname, os.path.join(self.path, "symlink_dir"),
                        target_is_directory=True)



More information about the Python-checkins mailing list