summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-10-25 16:01:41 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-10-25 16:01:41 (GMT)
commit28f982060c1a4497cc5b824655e4eb0e5bc4baf8 (patch)
tree5886e63da49e5e7a693ec5402efa813ee1ca4b99 /Lib/test
parent16591f440d650f77c841a3245785e2423a50249f (diff)
downloadcpython-28f982060c1a4497cc5b824655e4eb0e5bc4baf8.zip
cpython-28f982060c1a4497cc5b824655e4eb0e5bc4baf8.tar.gz
cpython-28f982060c1a4497cc5b824655e4eb0e5bc4baf8.tar.bz2
Issue #28353: Try to fix tests.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_os.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 8859838..9bfb244 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -892,14 +892,22 @@ class WalkTests(unittest.TestCase):
os.symlink('broken', broken_link_path, True)
os.symlink(join('tmp3', 'broken'), broken_link2_path, True)
os.symlink(join('SUB21', 'tmp5'), broken_link3_path, True)
- self.sub2_tree = (sub2_path, ["link", "SUB21"],
+ self.sub2_tree = (sub2_path, ["SUB21", "link"],
["broken_link", "broken_link2", "broken_link3",
"tmp3"])
else:
self.sub2_tree = (sub2_path, [], ["tmp3"])
os.chmod(sub21_path, 0)
- self.addCleanup(os.chmod, sub21_path, stat.S_IRWXU)
+ try:
+ os.listdir(sub21_path)
+ except PermissionError:
+ self.addCleanup(os.chmod, sub21_path, stat.S_IRWXU)
+ else:
+ os.chmod(sub21_path, stat.S_IRWXU)
+ os.unlink(tmp5_path)
+ os.rmdir(sub21_path)
+ del self.sub2_tree[1][:1]
def test_walk_topdown(self):
# Walk top-down.
@@ -912,6 +920,7 @@ class WalkTests(unittest.TestCase):
flipped = all[0][1][0] != "SUB1"
all[0][1].sort()
all[3 - 2 * flipped][-1].sort()
+ all[3 - 2 * flipped][1].sort()
self.assertEqual(all[0], (self.walk_path, ["SUB1", "SUB2"], ["tmp1"]))
self.assertEqual(all[1 + flipped], (self.sub1_path, ["SUB11"], ["tmp2"]))
self.assertEqual(all[2 + flipped], (self.sub11_path, [], []))
@@ -934,6 +943,7 @@ class WalkTests(unittest.TestCase):
(str(walk_path), ["SUB2"], ["tmp1"]))
all[1][-1].sort()
+ all[1][1].sort()
self.assertEqual(all[1], self.sub2_tree)
def test_file_like_path(self):
@@ -950,6 +960,7 @@ class WalkTests(unittest.TestCase):
flipped = all[3][1][0] != "SUB1"
all[3][1].sort()
all[2 - 2 * flipped][-1].sort()
+ all[2 - 2 * flipped][1].sort()
self.assertEqual(all[3],
(self.walk_path, ["SUB1", "SUB2"], ["tmp1"]))
self.assertEqual(all[flipped],