[Python-checkins] cpython (merge 3.3 -> default): Issue #17746: Skip test_shutil.test_non_matching_mode when run as root or

serhiy.storchaka python-checkins at python.org
Tue May 28 14:56:34 CEST 2013


http://hg.python.org/cpython/rev/96e543ba96a4
changeset:   83954:96e543ba96a4
parent:      83952:29a823f31465
parent:      83953:b98380a1d979
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue May 28 15:53:46 2013 +0300
summary:
  Issue #17746: Skip test_shutil.test_non_matching_mode when run as root or
on unsuitable platform/environment.

files:
  Lib/test/test_shutil.py |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -1338,9 +1338,13 @@
                 # 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)
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list