diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-04-29 22:43:35 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-04-29 22:43:35 (GMT) |
commit | 9c6fc5187fbf23d584834e9c9697986c42cabecd (patch) | |
tree | 325f564cc9e73bcf535f1fda764606186affa16d /Lib | |
parent | 61a0d05291843fad785111b05b33e23185cb756a (diff) | |
download | cpython-9c6fc5187fbf23d584834e9c9697986c42cabecd.zip cpython-9c6fc5187fbf23d584834e9c9697986c42cabecd.tar.gz cpython-9c6fc5187fbf23d584834e9c9697986c42cabecd.tar.bz2 |
fix test_shutil on ZFS #5676
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_shutil.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index ac37a53..169290d 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -45,9 +45,23 @@ class TestShutil(unittest.TestCase): shutil.rmtree(TESTFN) def check_args_to_onerror(self, func, arg, exc): + # test_rmtree_errors deliberately runs rmtree + # on a directory that is chmod 400, which will fail. + # This function is run when shutil.rmtree fails. + # 99.9% of the time it initially fails to remove + # a file in the directory, so the first time through + # func is os.remove. + # However, some Linux machines running ZFS on + # FUSE experienced a failure earlier in the process + # at os.listdir. The first failure may legally + # be either. if self.errorState == 0: - self.assertEqual(func, os.remove) - self.assertEqual(arg, self.childpath) + if func is os.remove: + self.assertEqual(arg, self.childpath) + else: + self.assertIs(func, os.listdir, + "func must be either os.remove or os.listdir") + self.assertEqual(arg, TESTFN) self.failUnless(issubclass(exc[0], OSError)) self.errorState = 1 else: |