[Python-checkins] python/dist/src/Lib/test test_shutil.py, 1.10, 1.11

jlgijsbers at users.sourceforge.net jlgijsbers at users.sourceforge.net
Mon Dec 6 21:50:17 CET 2004


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

Modified Files:
	test_shutil.py 
Log Message:
SF bug #1076467: don't run test_on_error as root, as the permission
errors don't get provoked that way. Also add a bunch of cross-references
to bugs.


Index: test_shutil.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shutil.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- test_shutil.py	23 Nov 2004 09:27:27 -0000	1.10
+++ test_shutil.py	6 Dec 2004 20:50:15 -0000	1.11
@@ -16,7 +16,10 @@
         filename = tempfile.mktemp()
         self.assertRaises(OSError, shutil.rmtree, filename)
 
-    if hasattr(os, 'chmod') and sys.platform[:6] != 'cygwin':
+    # See bug #1071513 for why we don't run this on cygwin
+    # and bug #1076467 for why we don't run this as root.
+    if (hasattr(os, 'chmod') and sys.platform[:6] != 'cygwin'
+        and os.getenv('USER') != 'root'):
         def test_on_error(self):
             self.errorState = 0
             os.mkdir(TESTFN)
@@ -31,7 +34,8 @@
 
             shutil.rmtree(TESTFN, onerror=self.check_args_to_onerror)
             # Test whether onerror has actually been called.
-            self.assertEqual(self.errorState, 2)
+            self.assertEqual(self.errorState, 2,
+                             "Expected call to onerror function did not happen.")
 
             # Make writable again.
             os.chmod(TESTFN, old_dir_mode)



More information about the Python-checkins mailing list