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
4f7a36f8
Kaydet (Commit)
4f7a36f8
authored
Eyl 08, 2013
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #18904: test_os and test_socket use unittest.skipIf() to check if fcntl
module is present (to record skipped tests)
üst
5da7e795
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
46 deletions
+48
-46
test_os.py
Lib/test/test_os.py
+23
-22
test_socket.py
Lib/test/test_socket.py
+25
-24
No files found.
Lib/test/test_os.py
Dosyayı görüntüle @
4f7a36f8
...
@@ -2312,28 +2312,29 @@ class FDInheritanceTests(unittest.TestCase):
...
@@ -2312,28 +2312,29 @@ class FDInheritanceTests(unittest.TestCase):
os
.
set_inheritable
(
fd
,
True
)
os
.
set_inheritable
(
fd
,
True
)
self
.
assertEqual
(
os
.
get_inheritable
(
fd
),
True
)
self
.
assertEqual
(
os
.
get_inheritable
(
fd
),
True
)
if
fcntl
:
@unittest.skipIf
(
fcntl
is
None
,
"need fcntl"
)
def
test_get_inheritable_cloexec
(
self
):
def
test_get_inheritable_cloexec
(
self
):
fd
=
os
.
open
(
__file__
,
os
.
O_RDONLY
)
fd
=
os
.
open
(
__file__
,
os
.
O_RDONLY
)
self
.
addCleanup
(
os
.
close
,
fd
)
self
.
addCleanup
(
os
.
close
,
fd
)
self
.
assertEqual
(
os
.
get_inheritable
(
fd
),
False
)
self
.
assertEqual
(
os
.
get_inheritable
(
fd
),
False
)
# clear FD_CLOEXEC flag
# clear FD_CLOEXEC flag
flags
=
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
flags
=
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
flags
&=
~
fcntl
.
FD_CLOEXEC
flags
&=
~
fcntl
.
FD_CLOEXEC
fcntl
.
fcntl
(
fd
,
fcntl
.
F_SETFD
,
flags
)
fcntl
.
fcntl
(
fd
,
fcntl
.
F_SETFD
,
flags
)
self
.
assertEqual
(
os
.
get_inheritable
(
fd
),
True
)
self
.
assertEqual
(
os
.
get_inheritable
(
fd
),
True
)
def
test_set_inheritable_cloexec
(
self
):
@unittest.skipIf
(
fcntl
is
None
,
"need fcntl"
)
fd
=
os
.
open
(
__file__
,
os
.
O_RDONLY
)
def
test_set_inheritable_cloexec
(
self
):
self
.
addCleanup
(
os
.
close
,
fd
)
fd
=
os
.
open
(
__file__
,
os
.
O_RDONLY
)
self
.
assertEqual
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
,
self
.
addCleanup
(
os
.
close
,
fd
)
fcntl
.
FD_CLOEXEC
)
self
.
assertEqual
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
,
fcntl
.
FD_CLOEXEC
)
os
.
set_inheritable
(
fd
,
True
)
self
.
assertEqual
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
,
os
.
set_inheritable
(
fd
,
True
)
0
)
self
.
assertEqual
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
,
0
)
def
test_open
(
self
):
def
test_open
(
self
):
fd
=
os
.
open
(
__file__
,
os
.
O_RDONLY
)
fd
=
os
.
open
(
__file__
,
os
.
O_RDONLY
)
...
...
Lib/test/test_socket.py
Dosyayı görüntüle @
4f7a36f8
...
@@ -4808,30 +4808,31 @@ class InheritanceTest(unittest.TestCase):
...
@@ -4808,30 +4808,31 @@ class InheritanceTest(unittest.TestCase):
sock
.
set_inheritable
(
False
)
sock
.
set_inheritable
(
False
)
self
.
assertEqual
(
sock
.
get_inheritable
(),
False
)
self
.
assertEqual
(
sock
.
get_inheritable
(),
False
)
if
fcntl
:
@unittest.skipIf
(
fcntl
is
None
,
"need fcntl"
)
def
test_get_inheritable_cloexec
(
self
):
def
test_get_inheritable_cloexec
(
self
):
sock
=
socket
.
socket
()
sock
=
socket
.
socket
()
with
sock
:
with
sock
:
fd
=
sock
.
fileno
()
fd
=
sock
.
fileno
()
self
.
assertEqual
(
sock
.
get_inheritable
(),
False
)
self
.
assertEqual
(
sock
.
get_inheritable
(),
False
)
# clear FD_CLOEXEC flag
# clear FD_CLOEXEC flag
flags
=
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
flags
=
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
flags
&=
~
fcntl
.
FD_CLOEXEC
flags
&=
~
fcntl
.
FD_CLOEXEC
fcntl
.
fcntl
(
fd
,
fcntl
.
F_SETFD
,
flags
)
fcntl
.
fcntl
(
fd
,
fcntl
.
F_SETFD
,
flags
)
self
.
assertEqual
(
sock
.
get_inheritable
(),
True
)
self
.
assertEqual
(
sock
.
get_inheritable
(),
True
)
def
test_set_inheritable_cloexec
(
self
):
@unittest.skipIf
(
fcntl
is
None
,
"need fcntl"
)
sock
=
socket
.
socket
()
def
test_set_inheritable_cloexec
(
self
):
with
sock
:
sock
=
socket
.
socket
()
fd
=
sock
.
fileno
()
with
sock
:
self
.
assertEqual
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
,
fd
=
sock
.
fileno
()
fcntl
.
FD_CLOEXEC
)
self
.
assertEqual
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
,
fcntl
.
FD_CLOEXEC
)
sock
.
set_inheritable
(
True
)
self
.
assertEqual
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
,
sock
.
set_inheritable
(
True
)
0
)
self
.
assertEqual
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
,
0
)
@unittest.skipUnless
(
hasattr
(
socket
,
"socketpair"
),
@unittest.skipUnless
(
hasattr
(
socket
,
"socketpair"
),
...
...
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