]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #17746: Skip test_shutil.test_non_matching_mode when run as root or
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 28 May 2013 12:50:15 +0000 (15:50 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 28 May 2013 12:50:15 +0000 (15:50 +0300)
on unsuitable platform/environment.

Lib/test/test_shutil.py

index 308f4f2b7b1197844e4a7e203e04af0abd6f85ec..6794a9357459a192b00c9479840e1917500d0dcb 100644 (file)
@@ -1327,9 +1327,13 @@ class TestWhich(unittest.TestCase):
                 # Other platforms: shouldn't match in the current directory.
                 self.assertIsNone(rv)
 
+    @unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0,
+                     'non-root user required')
     def test_non_matching_mode(self):
         # Set the file read-only and ask for writeable files.
         os.chmod(self.temp_file.name, stat.S_IREAD)
+        if os.access(self.temp_file.name, os.W_OK):
+            self.skipTest("can't set the file read-only")
         rv = shutil.which(self.file, path=self.dir, mode=os.W_OK)
         self.assertIsNone(rv)