summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_shutil.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-01-20 14:17:42 (GMT)
committerGeorg Brandl <georg@python.org>2008-01-20 14:17:42 (GMT)
commit5235398323aeb40c3fda4ad2daea3beebb6ff11f (patch)
tree9e5be28b182abe13cb1ba64dad171d694517798f /Lib/test/test_shutil.py
parent56112895d69131ee4f34d4e3e9406614313df57f (diff)
downloadcpython-5235398323aeb40c3fda4ad2daea3beebb6ff11f.zip
cpython-5235398323aeb40c3fda4ad2daea3beebb6ff11f.tar.gz
cpython-5235398323aeb40c3fda4ad2daea3beebb6ff11f.tar.bz2
#1669: don't allow shutil.rmtree() to be called on a symlink.
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r--Lib/test/test_shutil.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index ee15d0e..b63031e 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -149,6 +149,20 @@ class TestShutil(unittest.TestCase):
except OSError:
pass
+ def test_rmtree_on_symlink(self):
+ # bug 1669.
+ os.mkdir(TESTFN)
+ try:
+ src = os.path.join(TESTFN, 'cheese')
+ dst = os.path.join(TESTFN, 'shop')
+ os.mkdir(src)
+ os.symlink(src, dst)
+ self.assertRaises(OSError, shutil.rmtree, dst)
+ finally:
+ shutil.rmtree(TESTFN, ignore_errors=True)
+
+
+
def test_main():
test_support.run_unittest(TestShutil)