From: Johannes Gijsbers Date: Sat, 11 Sep 2004 21:26:21 +0000 (+0000) Subject: Document not-completely-obvious behavior in a test. X-Git-Tag: v2.4b1~291 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d60e92a48d1e4d2298200e688329eda7a326be4a;p=python Document not-completely-obvious behavior in a test. --- diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 9e5f6ff048..f8367a60c2 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -16,6 +16,13 @@ class TestShutil(unittest.TestCase): self.assertEqual(shutil.rmtree(filename, True), None) shutil.rmtree(filename, False, lambda func, arg, exc: None) + def test_rmtree_dont_delete_file(self): + # When called on a file instead of a directory, don't delete it. + handle, path = tempfile.mkstemp() + os.fdopen(handle).close() + self.assertRaises(OSError, shutil.rmtree, path) + os.remove(path) + def test_dont_move_dir_in_itself(self): src_dir = tempfile.mkdtemp() try: