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
105df5d7
Kaydet (Commit)
105df5d7
authored
Eki 29, 2010
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Move test_httpservers over to file context managers.
üst
d2eca37c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
test_httpservers.py
Lib/test/test_httpservers.py
+11
-12
No files found.
Lib/test/test_httpservers.py
Dosyayı görüntüle @
105df5d7
...
...
@@ -206,9 +206,8 @@ class SimpleHTTPServerTestCase(BaseTestCase):
self
.
data
=
b
'We are the knights who say Ni!'
self
.
tempdir
=
tempfile
.
mkdtemp
(
dir
=
basetempdir
)
self
.
tempdir_name
=
os
.
path
.
basename
(
self
.
tempdir
)
temp
=
open
(
os
.
path
.
join
(
self
.
tempdir
,
'test'
),
'wb'
)
temp
.
write
(
self
.
data
)
temp
.
close
()
with
open
(
os
.
path
.
join
(
self
.
tempdir
,
'test'
),
'wb'
)
as
temp
:
temp
.
write
(
self
.
data
)
def
tearDown
(
self
):
try
:
...
...
@@ -240,15 +239,15 @@ class SimpleHTTPServerTestCase(BaseTestCase):
self
.
check_status_and_reason
(
response
,
404
)
response
=
self
.
request
(
'/'
+
'ThisDoesNotExist'
+
'/'
)
self
.
check_status_and_reason
(
response
,
404
)
f
=
open
(
os
.
path
.
join
(
self
.
tempdir_name
,
'index.html'
),
'w'
)
response
=
self
.
request
(
'/'
+
self
.
tempdir_name
+
'/'
)
self
.
check_status_and_reason
(
response
,
200
)
if
os
.
name
==
'posix'
:
# chmod won't work as expected on Windows platforms
os
.
chmod
(
self
.
tempdir
,
0
)
response
=
self
.
request
(
self
.
tempdir_name
+
'/'
)
self
.
check_status_and_reason
(
response
,
404
)
os
.
chmod
(
self
.
tempdir
,
0
o755
)
with
open
(
os
.
path
.
join
(
self
.
tempdir_name
,
'index.html'
),
'w'
)
as
f
:
response
=
self
.
request
(
'/'
+
self
.
tempdir_name
+
'/'
)
self
.
check_status_and_reason
(
response
,
200
)
if
os
.
name
==
'posix'
:
# chmod won't work as expected on Windows platforms
os
.
chmod
(
self
.
tempdir
,
0
)
response
=
self
.
request
(
self
.
tempdir_name
+
'/'
)
self
.
check_status_and_reason
(
response
,
404
)
os
.
chmod
(
self
.
tempdir
,
0
o755
)
def
test_head
(
self
):
response
=
self
.
request
(
...
...
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