diff options
author | Johannes Gijsbers <jlg@dds.nl> | 2004-11-23 09:27:27 (GMT) |
---|---|---|
committer | Johannes Gijsbers <jlg@dds.nl> | 2004-11-23 09:27:27 (GMT) |
commit | 8e6f2ded301055b3e8b61018175cd758ec4ad150 (patch) | |
tree | 7c5deff3e76601f64d8307b5b362093abcac3cf0 /Lib/test | |
parent | 7f13cfa6741ce4a3b5557a9bc10de302dabccd90 (diff) | |
download | cpython-8e6f2ded301055b3e8b61018175cd758ec4ad150.zip cpython-8e6f2ded301055b3e8b61018175cd758ec4ad150.tar.gz cpython-8e6f2ded301055b3e8b61018175cd758ec4ad150.tar.bz2 |
Bug #1071513: don't test on Cygwin, as chmod doesn't work reliably there
(http://www.cygwin.com/faq/faq_3.html#SEC41).
Also check whether onerror has actually been called so this test will
fail on assertion instead of on trying to chmod a non-existent file.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_shutil.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 32197b3..1db3fc5 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -3,6 +3,7 @@ import unittest import shutil import tempfile +import sys import stat import os import os.path @@ -15,7 +16,7 @@ class TestShutil(unittest.TestCase): filename = tempfile.mktemp() self.assertRaises(OSError, shutil.rmtree, filename) - if hasattr(os, 'chmod'): + if hasattr(os, 'chmod') and sys.platform[:6] != 'cygwin': def test_on_error(self): self.errorState = 0 os.mkdir(TESTFN) @@ -29,6 +30,8 @@ class TestShutil(unittest.TestCase): os.chmod(TESTFN, stat.S_IREAD) shutil.rmtree(TESTFN, onerror=self.check_args_to_onerror) + # Test whether onerror has actually been called. + self.assertEqual(self.errorState, 2) # Make writable again. os.chmod(TESTFN, old_dir_mode) @@ -47,6 +50,7 @@ class TestShutil(unittest.TestCase): self.assertEqual(func, os.rmdir) self.assertEqual(arg, TESTFN) self.assertEqual(exc[0], OSError) + self.errorState = 2 def test_rmtree_dont_delete_file(self): # When called on a file instead of a directory, don't delete it. |