summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_shutil.py
diff options
context:
space:
mode:
authorHynek Schlawack <hs@ox.cx>2012-06-29 06:28:20 (GMT)
committerHynek Schlawack <hs@ox.cx>2012-06-29 06:28:20 (GMT)
commitd0f6e0a6e61d2ded83ddf46db193cf97eb3b878c (patch)
tree7649ea9c2d44d13033d0c46023ced52722e4c3b4 /Lib/test/test_shutil.py
parent0b50bf3ffc8beb8fe808fc2dd17253e8a4794a05 (diff)
downloadcpython-d0f6e0a6e61d2ded83ddf46db193cf97eb3b878c.zip
cpython-d0f6e0a6e61d2ded83ddf46db193cf97eb3b878c.tar.gz
cpython-d0f6e0a6e61d2ded83ddf46db193cf97eb3b878c.tar.bz2
Check for all used fd-based functions in shutil.rmdir, closes #15218
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r--Lib/test/test_shutil.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index cb712b3..a2b6e88 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -524,7 +524,11 @@ class TestShutil(unittest.TestCase):
self.assertFalse(os.path.islink(dst))
def test_rmtree_uses_safe_fd_version_if_available(self):
- if os.unlink in os.supports_dir_fd and os.open in os.supports_dir_fd:
+ _use_fd_functions = ({os.open, os.stat, os.unlink, os.rmdir} <=
+ os.supports_dir_fd and
+ os.listdir in os.supports_fd and
+ os.stat in os.supports_follow_symlinks)
+ if _use_fd_functions:
self.assertTrue(shutil._use_fd_functions)
self.assertTrue(shutil.rmtree.avoids_symlink_attacks)
tmp_dir = self.mkdtemp()