Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
36888dd9
Kaydet (Commit)
36888dd9
authored
Eki 25, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #28353: Fixed tests of os.fwalk() with broken links.
üst
48325805
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
test_os.py
Lib/test/test_os.py
+18
-3
No files found.
Lib/test/test_os.py
Dosyayı görüntüle @
36888dd9
...
@@ -869,13 +869,23 @@ class WalkTests(unittest.TestCase):
...
@@ -869,13 +869,23 @@ class WalkTests(unittest.TestCase):
os
.
symlink
(
'broken'
,
broken_link_path
,
True
)
os
.
symlink
(
'broken'
,
broken_link_path
,
True
)
os
.
symlink
(
join
(
'tmp3'
,
'broken'
),
broken_link2_path
,
True
)
os
.
symlink
(
join
(
'tmp3'
,
'broken'
),
broken_link2_path
,
True
)
os
.
symlink
(
join
(
'SUB21'
,
'tmp5'
),
broken_link3_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"
,
[
"broken_link"
,
"broken_link2"
,
"broken_link3"
,
"tmp3"
])
"tmp3"
])
else
:
else
:
self
.
sub2_tree
=
(
sub2_path
,
[],
[
"tmp3"
])
self
.
sub2_tree
=
(
sub2_path
,
[],
[
"tmp3"
])
os
.
chmod
(
self
.
sub21_path
,
0
)
os
.
chmod
(
self
.
sub21_path
,
0
)
try
:
os
.
listdir
(
self
.
sub21_path
)
except
PermissionError
:
pass
else
:
os
.
chmod
(
self
.
sub21_path
,
stat
.
S_IRWXU
)
os
.
unlink
(
tmp5_path
)
os
.
rmdir
(
self
.
sub21_path
)
self
.
sub21_path
=
None
del
self
.
sub2_tree
[
1
][:
1
]
def
test_walk_topdown
(
self
):
def
test_walk_topdown
(
self
):
# Walk top-down.
# Walk top-down.
...
@@ -888,6 +898,7 @@ class WalkTests(unittest.TestCase):
...
@@ -888,6 +898,7 @@ class WalkTests(unittest.TestCase):
flipped
=
all
[
0
][
1
][
0
]
!=
"SUB1"
flipped
=
all
[
0
][
1
][
0
]
!=
"SUB1"
all
[
0
][
1
]
.
sort
()
all
[
0
][
1
]
.
sort
()
all
[
3
-
2
*
flipped
][
-
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
[
0
],
(
self
.
walk_path
,
[
"SUB1"
,
"SUB2"
],
[
"tmp1"
]))
self
.
assertEqual
(
all
[
1
+
flipped
],
(
self
.
sub1_path
,
[
"SUB11"
],
[
"tmp2"
]))
self
.
assertEqual
(
all
[
1
+
flipped
],
(
self
.
sub1_path
,
[
"SUB11"
],
[
"tmp2"
]))
self
.
assertEqual
(
all
[
2
+
flipped
],
(
self
.
sub11_path
,
[],
[]))
self
.
assertEqual
(
all
[
2
+
flipped
],
(
self
.
sub11_path
,
[],
[]))
...
@@ -908,6 +919,7 @@ class WalkTests(unittest.TestCase):
...
@@ -908,6 +919,7 @@ class WalkTests(unittest.TestCase):
(
self
.
walk_path
,
[
"SUB2"
],
[
"tmp1"
]))
(
self
.
walk_path
,
[
"SUB2"
],
[
"tmp1"
]))
all
[
1
][
-
1
]
.
sort
()
all
[
1
][
-
1
]
.
sort
()
all
[
1
][
1
]
.
sort
()
self
.
assertEqual
(
all
[
1
],
self
.
sub2_tree
)
self
.
assertEqual
(
all
[
1
],
self
.
sub2_tree
)
def
test_walk_bottom_up
(
self
):
def
test_walk_bottom_up
(
self
):
...
@@ -921,6 +933,7 @@ class WalkTests(unittest.TestCase):
...
@@ -921,6 +933,7 @@ class WalkTests(unittest.TestCase):
flipped
=
all
[
3
][
1
][
0
]
!=
"SUB1"
flipped
=
all
[
3
][
1
][
0
]
!=
"SUB1"
all
[
3
][
1
]
.
sort
()
all
[
3
][
1
]
.
sort
()
all
[
2
-
2
*
flipped
][
-
1
]
.
sort
()
all
[
2
-
2
*
flipped
][
-
1
]
.
sort
()
all
[
2
-
2
*
flipped
][
1
]
.
sort
()
self
.
assertEqual
(
all
[
3
],
self
.
assertEqual
(
all
[
3
],
(
self
.
walk_path
,
[
"SUB1"
,
"SUB2"
],
[
"tmp1"
]))
(
self
.
walk_path
,
[
"SUB1"
,
"SUB2"
],
[
"tmp1"
]))
self
.
assertEqual
(
all
[
flipped
],
self
.
assertEqual
(
all
[
flipped
],
...
@@ -949,7 +962,8 @@ class WalkTests(unittest.TestCase):
...
@@ -949,7 +962,8 @@ class WalkTests(unittest.TestCase):
# Windows, which doesn't have a recursive delete command. The
# Windows, which doesn't have a recursive delete command. The
# (not so) subtlety is that rmdir will fail unless the dir's
# (not so) subtlety is that rmdir will fail unless the dir's
# kids are removed first, so bottom up is essential.
# kids are removed first, so bottom up is essential.
os
.
chmod
(
self
.
sub21_path
,
stat
.
S_IRWXU
)
if
self
.
sub21_path
:
os
.
chmod
(
self
.
sub21_path
,
stat
.
S_IRWXU
)
for
root
,
dirs
,
files
in
os
.
walk
(
support
.
TESTFN
,
topdown
=
False
):
for
root
,
dirs
,
files
in
os
.
walk
(
support
.
TESTFN
,
topdown
=
False
):
for
name
in
files
:
for
name
in
files
:
os
.
remove
(
os
.
path
.
join
(
root
,
name
))
os
.
remove
(
os
.
path
.
join
(
root
,
name
))
...
@@ -1045,7 +1059,8 @@ class FwalkTests(WalkTests):
...
@@ -1045,7 +1059,8 @@ class FwalkTests(WalkTests):
def
tearDown
(
self
):
def
tearDown
(
self
):
# cleanup
# cleanup
os
.
chmod
(
self
.
sub21_path
,
stat
.
S_IRWXU
)
if
self
.
sub21_path
:
os
.
chmod
(
self
.
sub21_path
,
stat
.
S_IRWXU
)
for
root
,
dirs
,
files
,
rootfd
in
os
.
fwalk
(
support
.
TESTFN
,
topdown
=
False
):
for
root
,
dirs
,
files
,
rootfd
in
os
.
fwalk
(
support
.
TESTFN
,
topdown
=
False
):
for
name
in
files
:
for
name
in
files
:
os
.
unlink
(
name
,
dir_fd
=
rootfd
)
os
.
unlink
(
name
,
dir_fd
=
rootfd
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment