[Python-checkins] python/dist/src/Lib/test test_shutil.py,1.5,1.6

jlgijsbers at users.sourceforge.net jlgijsbers at users.sourceforge.net
Sat Aug 14 15:57:11 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17756

Modified Files:
	test_shutil.py 
Log Message:
Unwrap too-smart loop: we can't use `src` for both hard and symbolic links.


Index: test_shutil.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shutil.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** test_shutil.py	14 Aug 2004 13:30:02 -0000	1.5
--- test_shutil.py	14 Aug 2004 13:57:08 -0000	1.6
***************
*** 32,46 ****
              # bug 851123.
              os.mkdir(TESTFN)
!             src = os.path.join(TESTFN,'cheese')
!             dst = os.path.join(TESTFN,'shop')
              try:
!                 f = open(src,'w')
                  f.write('cheddar')
                  f.close()
!                 for funcname in 'link','symlink':
!                     getattr(os, funcname)(src, dst)
!                     self.assertRaises(shutil.Error, shutil.copyfile, src, dst)
!                     self.assertEqual(open(src,'r').read(), 'cheddar')
!                     os.remove(dst)
              finally:
                  try:
--- 32,54 ----
              # bug 851123.
              os.mkdir(TESTFN)
!             src = os.path.join(TESTFN, 'cheese')
!             dst = os.path.join(TESTFN, 'shop')
              try:
!                 f = open(src, 'w')
                  f.write('cheddar')
                  f.close()
! 
!                 os.link(src, dst)
!                 self.assertRaises(shutil.Error, shutil.copyfile, src, dst)
!                 self.assertEqual(open(src,'r').read(), 'cheddar')
!                 os.remove(dst)
! 
!                 # Using `src` here would mean we end up with a symlink pointing
!                 # to TESTFN/TESTFN/cheese, while it should point at
!                 # TESTFN/cheese.
!                 os.symlink('cheese', dst)
!                 self.assertRaises(shutil.Error, shutil.copyfile, src, dst)
!                 self.assertEqual(open(src,'r').read(), 'cheddar')
!                 os.remove(dst)
              finally:
                  try:



More information about the Python-checkins mailing list