Hello all,

Sourceforge is being anal and won't let me log in.

Attached is a patch for the shutil test, which would pickup bug "[1525866] Bug in shutil.copytree on Windows".

It passes against a bug-fixed shutil [1] on my XP box, and fails on an un-fixed one.

It only tests basic functionality of copytree. I did add tests that copystat had worked, but the mtime results were consistently off on Windows [2] so I removed that test.

I would appreciate it if someone could post this patch to sourceforge. IMO this bug needs fixing before 2.5 final, the fix is trivial and shutil.copytree is broken on windows without it.

All the best,


Michael Foord

[1] Bugfix supplied by Thomas Heller and is attached to the sourceforge bug report.
[2] And consistently off in a weird way FWIW...
76a77,103
>                 
>     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
>             
>             
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to