diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-06-23 20:05:11 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-06-23 20:05:11 (GMT) |
commit | 4f6e3f74fc89b87498e9c443a7186883208af169 (patch) | |
tree | d13a513a2f29d5ac854bf0920da934150136b1ff | |
parent | f3a166d799f9c86ffbbd5539de8e9faf314d7bcd (diff) | |
download | cpython-4f6e3f74fc89b87498e9c443a7186883208af169.zip cpython-4f6e3f74fc89b87498e9c443a7186883208af169.tar.gz cpython-4f6e3f74fc89b87498e9c443a7186883208af169.tar.bz2 |
Avoid depending on directory iteration order in test_shutil
-rw-r--r-- | Lib/test/test_shutil.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 455065f..b2ac0cf 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -158,14 +158,13 @@ class TestShutil(unittest.TestCase): # be either. if support.verbose: print("onerror [%d]: %r" % (self.errorState, (func, arg, exc[1]))) - if 0 <= self.errorState < 2: + if self.errorState < 2: if func is os.unlink: - self.assertIn(arg, [self.child_file_path, self.child_dir_path]) + self.assertEqual(arg, self.child_file_path) + elif func is os.rmdir: + self.assertEqual(arg, self.child_dir_path) else: - if self.errorState == 1: - self.assertEqual(func, os.rmdir) - else: - self.assertIs(func, os.listdir, "func must be os.listdir") + self.assertIs(func, os.listdir) self.assertIn(arg, [TESTFN, self.child_dir_path]) self.assertTrue(issubclass(exc[0], OSError)) self.errorState += 1 |