summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_shutil.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-07-30 13:00:31 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-07-30 13:00:31 (GMT)
commit4e67838d6c16d3ab14b01ffdb1318aa16ed9bccf (patch)
treef4b80659d7a5c73756f28bc3900cd7cd86b2808e /Lib/test/test_shutil.py
parente34ac7ce7a3ed56cf412a425637441f31dd0ad52 (diff)
downloadcpython-4e67838d6c16d3ab14b01ffdb1318aa16ed9bccf.zip
cpython-4e67838d6c16d3ab14b01ffdb1318aa16ed9bccf.tar.gz
cpython-4e67838d6c16d3ab14b01ffdb1318aa16ed9bccf.tar.bz2
Don't copy directory stat times in shutil.copytree on Windows
Fixes #1525866.
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r--Lib/test/test_shutil.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index 6ab5a35..79da538 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -74,6 +74,33 @@ class TestShutil(unittest.TestCase):
except:
pass
+
+ def test_copytree_simple(self):
+ src_dir = tempfile.mkdtemp()
+ dst_dir = os.path.join(tempfile.mkdtemp(), 'destination')
+ open(os.path.join(src_dir, 'test.txt'), 'w').write('123')
+ os.mkdir(os.path.join(src_dir, 'test_dir'))
+ open(os.path.join(src_dir, 'test_dir', 'test.txt'), 'w').write('456')
+ #
+ try:
+ shutil.copytree(src_dir, dst_dir)
+ self.assertTrue(os.path.isfile(os.path.join(dst_dir, 'test.txt')))
+ self.assertTrue(os.path.isdir(os.path.join(dst_dir, 'test_dir')))
+ self.assertTrue(os.path.isfile(os.path.join(dst_dir, 'test_dir', 'test.txt')))
+ self.assertEqual(open(os.path.join(dst_dir, 'test.txt')).read(), '123')
+ self.assertEqual(open(os.path.join(dst_dir, 'test_dir', 'test.txt')).read(), '456')
+ finally:
+ try:
+ os.remove(os.path.join(src_dir, 'test.txt'))
+ os.remove(os.path.join(dst_dir, 'test.txt'))
+ os.remove(os.path.join(src_dir, 'test_dir', 'test.txt'))
+ os.remove(os.path.join(dst_dir, 'test_dir', 'test.txt'))
+ os.removedirs(src_dir)
+ os.removedirs(dst_dir)
+ except:
+ pass
+
+
if hasattr(os, "symlink"):
def test_dont_copy_file_onto_link_to_itself(self):
# bug 851123.