diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-03-20 05:23:09 +0000 |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-03-20 05:23:09 +0000 |
commit | c990f6454f2725c143f215d49de305ecb2a935e0 (patch) | |
tree | 46daae0bd01cacc40b7972925192c18c398acbfe /Lib/test | |
parent | c473d5ebabae4375f767ae1125e1b28809d45701 (diff) | |
download | cpython-git-c990f6454f2725c143f215d49de305ecb2a935e0.tar.gz |
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_os.py | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index a40dd5eb25..9dcdb1808f 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -277,34 +277,22 @@ class WalkTests(unittest.TestCase): # SUB1/ a file kid and a directory kid # tmp2 # SUB11/ no kids - # SUB2/ a file kid and a dirsymlink kid + # SUB2/ just a file kid # tmp3 - # link/ a symlink to TESTFN.2 - # TESTFN.2/ - # tmp4 a lone file sub1_path = join(test_support.TESTFN, "SUB1") sub11_path = join(sub1_path, "SUB11") sub2_path = join(test_support.TESTFN, "SUB2") tmp1_path = join(test_support.TESTFN, "tmp1") tmp2_path = join(sub1_path, "tmp2") tmp3_path = join(sub2_path, "tmp3") - link_path = join(sub2_path, "link") - t2_path = join(test_support.TESTFN + ".2") - tmp4_path = join(test_support.TESTFN + ".2", "tmp4") # Create stuff. os.makedirs(sub11_path) os.makedirs(sub2_path) - os.makedirs(t2_path) - for path in tmp1_path, tmp2_path, tmp3_path, tmp4_path: + for path in tmp1_path, tmp2_path, tmp3_path: f = file(path, "w") f.write("I'm " + path + " and proud of it. Blame test_os.\n") f.close() - if hasattr(os, "symlink"): - os.symlink(os.path.join("..", "..", t2_path), link_path) - else: - # it must be a directory because the test expects that - os.mkdir(link_path) # Walk top-down. all = list(os.walk(test_support.TESTFN)) @@ -317,7 +305,7 @@ class WalkTests(unittest.TestCase): self.assertEqual(all[0], (test_support.TESTFN, ["SUB1", "SUB2"], ["tmp1"])) self.assertEqual(all[1 + flipped], (sub1_path, ["SUB11"], ["tmp2"])) self.assertEqual(all[2 + flipped], (sub11_path, [], [])) - self.assertEqual(all[3 - 2 * flipped], (sub2_path, ["link"], ["tmp3"])) + self.assertEqual(all[3 - 2 * flipped], (sub2_path, [], ["tmp3"])) # Prune the search. all = [] @@ -329,7 +317,7 @@ class WalkTests(unittest.TestCase): dirs.remove('SUB1') self.assertEqual(len(all), 2) self.assertEqual(all[0], (test_support.TESTFN, ["SUB2"], ["tmp1"])) - self.assertEqual(all[1], (sub2_path, ["link"], ["tmp3"])) + self.assertEqual(all[1], (sub2_path, [], ["tmp3"])) # Walk bottom-up. all = list(os.walk(test_support.TESTFN, topdown=False)) @@ -342,17 +330,7 @@ class WalkTests(unittest.TestCase): self.assertEqual(all[3], (test_support.TESTFN, ["SUB1", "SUB2"], ["tmp1"])) self.assertEqual(all[flipped], (sub11_path, [], [])) self.assertEqual(all[flipped + 1], (sub1_path, ["SUB11"], ["tmp2"])) - self.assertEqual(all[2 - 2 * flipped], (sub2_path, ["link"], ["tmp3"])) - - # Walk, following symlinks. - for root, dirs, files in os.walk(test_support.TESTFN, followlinks=True): - if root == link_path: - self.assertEqual(dirs, []) - self.assertEqual(files, ["tmp4"]) - break - else: - self.fail("Didn't follow symlink with followlinks=True") - + self.assertEqual(all[2 - 2 * flipped], (sub2_path, [], ["tmp3"])) # Tear everything down. This is a decent use for bottom-up on # Windows, which doesn't have a recursive delete command. The @@ -362,14 +340,8 @@ class WalkTests(unittest.TestCase): for name in files: os.remove(join(root, name)) for name in dirs: - dirname = join(root, name) - if not os.path.islink(dirname): - os.rmdir(dirname) - else: - os.remove(dirname) + os.rmdir(join(root, name)) os.rmdir(test_support.TESTFN) - os.unlink(tmp4_path) - os.rmdir(t2_path) class MakedirTests (unittest.TestCase): def setUp(self): |