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
5fd174a7
Kaydet (Commit)
5fd174a7
authored
Şub 15, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Use os.devnull instead of hardcoded '/dev/null'.
üst
9121fe84
56abe390
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
test_unix_events.py
Lib/test/test_asyncio/test_unix_events.py
+3
-3
test_bz2.py
Lib/test/test_bz2.py
+5
-5
test_cgi.py
Lib/test/test_cgi.py
+2
-2
test_subprocess.py
Lib/test/test_subprocess.py
+2
-2
No files found.
Lib/test/test_asyncio/test_unix_events.py
Dosyayı görüntüle @
5fd174a7
...
@@ -295,7 +295,7 @@ class SelectorEventLoopUnixSocketTests(test_utils.TestCase):
...
@@ -295,7 +295,7 @@ class SelectorEventLoopUnixSocketTests(test_utils.TestCase):
def
test_create_unix_connection_path_sock
(
self
):
def
test_create_unix_connection_path_sock
(
self
):
coro
=
self
.
loop
.
create_unix_connection
(
coro
=
self
.
loop
.
create_unix_connection
(
lambda
:
None
,
'/dev/null'
,
sock
=
object
())
lambda
:
None
,
os
.
devnull
,
sock
=
object
())
with
self
.
assertRaisesRegex
(
ValueError
,
'path and sock can not be'
):
with
self
.
assertRaisesRegex
(
ValueError
,
'path and sock can not be'
):
self
.
loop
.
run_until_complete
(
coro
)
self
.
loop
.
run_until_complete
(
coro
)
...
@@ -308,14 +308,14 @@ class SelectorEventLoopUnixSocketTests(test_utils.TestCase):
...
@@ -308,14 +308,14 @@ class SelectorEventLoopUnixSocketTests(test_utils.TestCase):
def
test_create_unix_connection_nossl_serverhost
(
self
):
def
test_create_unix_connection_nossl_serverhost
(
self
):
coro
=
self
.
loop
.
create_unix_connection
(
coro
=
self
.
loop
.
create_unix_connection
(
lambda
:
None
,
'/dev/null'
,
server_hostname
=
'spam'
)
lambda
:
None
,
os
.
devnull
,
server_hostname
=
'spam'
)
with
self
.
assertRaisesRegex
(
ValueError
,
with
self
.
assertRaisesRegex
(
ValueError
,
'server_hostname is only meaningful'
):
'server_hostname is only meaningful'
):
self
.
loop
.
run_until_complete
(
coro
)
self
.
loop
.
run_until_complete
(
coro
)
def
test_create_unix_connection_ssl_noserverhost
(
self
):
def
test_create_unix_connection_ssl_noserverhost
(
self
):
coro
=
self
.
loop
.
create_unix_connection
(
coro
=
self
.
loop
.
create_unix_connection
(
lambda
:
None
,
'/dev/null'
,
ssl
=
True
)
lambda
:
None
,
os
.
devnull
,
ssl
=
True
)
with
self
.
assertRaisesRegex
(
with
self
.
assertRaisesRegex
(
ValueError
,
'you have to pass server_hostname when using ssl'
):
ValueError
,
'you have to pass server_hostname when using ssl'
):
...
...
Lib/test/test_bz2.py
Dosyayı görüntüle @
5fd174a7
...
@@ -87,11 +87,11 @@ class BZ2FileTest(BaseTest):
...
@@ -87,11 +87,11 @@ class BZ2FileTest(BaseTest):
def
testBadArgs
(
self
):
def
testBadArgs
(
self
):
self
.
assertRaises
(
TypeError
,
BZ2File
,
123.456
)
self
.
assertRaises
(
TypeError
,
BZ2File
,
123.456
)
self
.
assertRaises
(
ValueError
,
BZ2File
,
"/dev/null"
,
"z"
)
self
.
assertRaises
(
ValueError
,
BZ2File
,
os
.
devnull
,
"z"
)
self
.
assertRaises
(
ValueError
,
BZ2File
,
"/dev/null"
,
"rx"
)
self
.
assertRaises
(
ValueError
,
BZ2File
,
os
.
devnull
,
"rx"
)
self
.
assertRaises
(
ValueError
,
BZ2File
,
"/dev/null"
,
"rbt"
)
self
.
assertRaises
(
ValueError
,
BZ2File
,
os
.
devnull
,
"rbt"
)
self
.
assertRaises
(
ValueError
,
BZ2File
,
"/dev/null"
,
compresslevel
=
0
)
self
.
assertRaises
(
ValueError
,
BZ2File
,
os
.
devnull
,
compresslevel
=
0
)
self
.
assertRaises
(
ValueError
,
BZ2File
,
"/dev/null"
,
compresslevel
=
10
)
self
.
assertRaises
(
ValueError
,
BZ2File
,
os
.
devnull
,
compresslevel
=
10
)
def
testRead
(
self
):
def
testRead
(
self
):
self
.
createTempFile
()
self
.
createTempFile
()
...
...
Lib/test/test_cgi.py
Dosyayı görüntüle @
5fd174a7
...
@@ -186,9 +186,9 @@ class CgiTests(unittest.TestCase):
...
@@ -186,9 +186,9 @@ class CgiTests(unittest.TestCase):
cgi
.
initlog
(
"
%
s"
,
"Testing initlog 1"
)
cgi
.
initlog
(
"
%
s"
,
"Testing initlog 1"
)
cgi
.
log
(
"
%
s"
,
"Testing log 2"
)
cgi
.
log
(
"
%
s"
,
"Testing log 2"
)
self
.
assertEqual
(
cgi
.
logfp
.
getvalue
(),
"Testing initlog 1
\n
Testing log 2
\n
"
)
self
.
assertEqual
(
cgi
.
logfp
.
getvalue
(),
"Testing initlog 1
\n
Testing log 2
\n
"
)
if
os
.
path
.
exists
(
"/dev/null"
):
if
os
.
path
.
exists
(
os
.
devnull
):
cgi
.
logfp
=
None
cgi
.
logfp
=
None
cgi
.
logfile
=
"/dev/null"
cgi
.
logfile
=
os
.
devnull
cgi
.
initlog
(
"
%
s"
,
"Testing log 3"
)
cgi
.
initlog
(
"
%
s"
,
"Testing log 3"
)
self
.
addCleanup
(
cgi
.
closelog
)
self
.
addCleanup
(
cgi
.
closelog
)
cgi
.
log
(
"Testing log 4"
)
cgi
.
log
(
"Testing log 4"
)
...
...
Lib/test/test_subprocess.py
Dosyayı görüntüle @
5fd174a7
...
@@ -1922,7 +1922,7 @@ class POSIXProcessTestCase(BaseTestCase):
...
@@ -1922,7 +1922,7 @@ class POSIXProcessTestCase(BaseTestCase):
open_fds
=
set
(
fds
)
open_fds
=
set
(
fds
)
# add a bunch more fds
# add a bunch more fds
for
_
in
range
(
9
):
for
_
in
range
(
9
):
fd
=
os
.
open
(
"/dev/null"
,
os
.
O_RDONLY
)
fd
=
os
.
open
(
os
.
devnull
,
os
.
O_RDONLY
)
self
.
addCleanup
(
os
.
close
,
fd
)
self
.
addCleanup
(
os
.
close
,
fd
)
open_fds
.
add
(
fd
)
open_fds
.
add
(
fd
)
...
@@ -1984,7 +1984,7 @@ class POSIXProcessTestCase(BaseTestCase):
...
@@ -1984,7 +1984,7 @@ class POSIXProcessTestCase(BaseTestCase):
open_fds = set()
open_fds = set()
# Add a bunch more fds to pass down.
# Add a bunch more fds to pass down.
for _ in range(40):
for _ in range(40):
fd = os.open(
"/dev/null"
, os.O_RDONLY)
fd = os.open(
os.devnull
, os.O_RDONLY)
open_fds.add(fd)
open_fds.add(fd)
# Leave a two pairs of low ones available for use by the
# Leave a two pairs of low ones available for use by the
...
...
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