[Python-checkins] python/dist/src/Lib/test test_shutil.py,1.2,1.3

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Sat Jun 19 17:11:37 EDT 2004


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

Modified Files:
	test_shutil.py 
Log Message:
shutil.move() will raise an exception when trying to move a directory into
itself.

Closes bug #919012  .  Thanks Johannes Gijsbers.


Index: test_shutil.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shutil.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_shutil.py	1 May 2003 17:45:49 -0000	1.2
--- test_shutil.py	19 Jun 2004 21:11:35 -0000	1.3
***************
*** 4,7 ****
--- 4,9 ----
  import shutil
  import tempfile
+ import os
+ import os.path
  from test import test_support
  
***************
*** 13,22 ****
          self.assertEqual(shutil.rmtree(filename, True), None)
  
  
- 
  def test_main():
      test_support.run_unittest(TestShutil)
  
- 
  if __name__ == '__main__':
      test_main()
--- 15,34 ----
          self.assertEqual(shutil.rmtree(filename, True), None)
  
+     def test_dont_move_dir_in_itself(self):
+         src_dir = tempfile.mkdtemp()
+         try:
+             dst = os.path.join(src_dir, 'foo')
+             self.assertRaises(shutil.Error, shutil.move, src_dir, dst)
+         finally:
+             try:
+                 os.rmdir(src_dir)
+             except:
+                 pass
+ 
+ 
  
  def test_main():
      test_support.run_unittest(TestShutil)
  
  if __name__ == '__main__':
      test_main()




More information about the Python-checkins mailing list