summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-05-28 12:53:46 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-05-28 12:53:46 (GMT)
commit5758fa78d0af2ca4cbbb819797372d055bb7faa1 (patch)
tree0ef6167fb9fce20f98f6961e111d6aec67723382 /Lib
parent5cc9d32ee9bd61a12e6e0eebdce61f8fb1652fc4 (diff)
parent12516e2c1b6dc577ea57ba45780637092afec671 (diff)
downloadcpython-5758fa78d0af2ca4cbbb819797372d055bb7faa1.zip
cpython-5758fa78d0af2ca4cbbb819797372d055bb7faa1.tar.gz
cpython-5758fa78d0af2ca4cbbb819797372d055bb7faa1.tar.bz2
Issue #17746: Skip test_shutil.test_non_matching_mode when run as root or
on unsuitable platform/environment.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_shutil.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index 7f88500..fad924a 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -1338,9 +1338,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)