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
69598527
Kaydet (Commit)
69598527
authored
Ara 14, 2016
tarafından
Xavier de Gaye
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #28683: Merge 3.6.
üst
e43edaad
e88ed050
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
8 deletions
+33
-8
__init__.py
Lib/test/support/__init__.py
+10
-0
test_asyncore.py
Lib/test/test_asyncore.py
+3
-1
test_pathlib.py
Lib/test/test_pathlib.py
+2
-1
test_socket.py
Lib/test/test_socket.py
+15
-6
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/support/__init__.py
Dosyayı görüntüle @
69598527
...
...
@@ -96,6 +96,7 @@ __all__ = [
"setswitchinterval"
,
"android_not_root"
,
# network
"HOST"
,
"IPV6_ENABLED"
,
"find_unused_port"
,
"bind_port"
,
"open_urlresource"
,
"bind_unix_socket"
,
# processes
'temp_umask'
,
"reap_children"
,
# logging
...
...
@@ -708,6 +709,15 @@ def bind_port(sock, host=HOST):
port
=
sock
.
getsockname
()[
1
]
return
port
def
bind_unix_socket
(
sock
,
addr
):
"""Bind a unix socket, raising SkipTest if PermissionError is raised."""
assert
sock
.
family
==
socket
.
AF_UNIX
try
:
sock
.
bind
(
addr
)
except
PermissionError
:
sock
.
close
()
raise
unittest
.
SkipTest
(
'cannot bind AF_UNIX sockets'
)
def
_is_ipv6_enabled
():
"""Check whether IPv6 is enabled on this host."""
if
socket
.
has_ipv6
:
...
...
Lib/test/test_asyncore.py
Dosyayı görüntüle @
69598527
...
...
@@ -95,7 +95,9 @@ def bind_af_aware(sock, addr):
if
HAS_UNIX_SOCKETS
and
sock
.
family
==
socket
.
AF_UNIX
:
# Make sure the path doesn't exist.
support
.
unlink
(
addr
)
sock
.
bind
(
addr
)
support
.
bind_unix_socket
(
sock
,
addr
)
else
:
sock
.
bind
(
addr
)
class
HelperFunctionTests
(
unittest
.
TestCase
):
...
...
Lib/test/test_pathlib.py
Dosyayı görüntüle @
69598527
...
...
@@ -1888,7 +1888,8 @@ class _BasePathTest(object):
try
:
sock
.
bind
(
str
(
P
))
except
OSError
as
e
:
if
"AF_UNIX path too long"
in
str
(
e
):
if
(
isinstance
(
e
,
PermissionError
)
or
"AF_UNIX path too long"
in
str
(
e
)):
self
.
skipTest
(
"cannot bind Unix socket: "
+
str
(
e
))
self
.
assertTrue
(
P
.
is_socket
())
self
.
assertFalse
(
P
.
is_fifo
())
...
...
Lib/test/test_socket.py
Dosyayı görüntüle @
69598527
...
...
@@ -278,8 +278,14 @@ class ThreadableTest:
def
clientRun
(
self
,
test_func
):
self
.
server_ready
.
wait
()
self
.
clientSetUp
()
self
.
client_ready
.
set
()
try
:
self
.
clientSetUp
()
except
BaseException
as
e
:
self
.
queue
.
put
(
e
)
self
.
clientTearDown
()
return
finally
:
self
.
client_ready
.
set
()
if
self
.
server_crashed
:
self
.
clientTearDown
()
return
...
...
@@ -520,8 +526,11 @@ class ConnectedStreamTestMixin(SocketListeningTestMixin,
self
.
serv_conn
=
self
.
cli
def
clientTearDown
(
self
):
self
.
serv_conn
.
close
()
self
.
serv_conn
=
None
try
:
self
.
serv_conn
.
close
()
self
.
serv_conn
=
None
except
AttributeError
:
pass
super
()
.
clientTearDown
()
...
...
@@ -540,7 +549,7 @@ class UnixSocketTestBase(SocketTestBase):
def
bindSock
(
self
,
sock
):
path
=
tempfile
.
mktemp
(
dir
=
self
.
dir_path
)
s
ock
.
bind
(
path
)
s
upport
.
bind_unix_socket
(
sock
,
path
)
self
.
addCleanup
(
support
.
unlink
,
path
)
class
UnixStreamBase
(
UnixSocketTestBase
):
...
...
@@ -4649,7 +4658,7 @@ class TestUnixDomain(unittest.TestCase):
def
bind
(
self
,
sock
,
path
):
# Bind the socket
try
:
s
ock
.
bind
(
path
)
s
upport
.
bind_unix_socket
(
sock
,
path
)
except
OSError
as
e
:
if
str
(
e
)
==
"AF_UNIX path too long"
:
self
.
skipTest
(
...
...
Misc/NEWS
Dosyayı görüntüle @
69598527
...
...
@@ -598,6 +598,9 @@ Tools/Demos
Tests
-----
- Issue #28683: Fix the tests that bind() a unix socket and raise
PermissionError on Android for a non-root user.
- Issue #26936: Fix the test_socket failures on Android - getservbyname(),
getservbyport() and getaddrinfo() are broken on some Android API levels.
...
...
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