Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
fd0fcfe3
Commit
fd0fcfe3
authored
Aug 02, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test_ares_timeout.py
parent
f27e9df1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
greentest/test_ares_timeout.py
greentest/test_ares_timeout.py
+31
-0
No files found.
greentest/test_ares_timeout.py
0 → 100644
View file @
fd0fcfe3
import
sys
import
gevent
from
gevent.resolver_ares
import
Resolver
from
gevent
import
socket
print
gevent
.
__file__
address
=
(
'127.0.0.10'
,
53
)
listener
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
try
:
listener
.
bind
(
address
)
except
socket
.
error
,
ex
:
if
'permission denied'
in
str
(
ex
).
lower
():
sys
.
stderr
.
write
(
'This test binds on port 53 and thus must be run as root.
\
n
'
)
sys
.
exit
(
0
)
raise
def
reader
():
while
True
:
print
listener
.
recvfrom
(
10000
)
gevent
.
spawn
(
reader
)
r
=
gevent
.
get_hub
().
resolver
=
Resolver
(
servers
=
[
'127.0.0.10'
],
timeout
=
0.001
,
tries
=
1
)
try
:
result
=
r
.
gethostbyname
(
'www.google.com'
)
except
socket
.
gaierror
,
ex
:
if
'ARES_ETIMEOUT'
not
in
str
(
ex
):
raise
else
:
raise
AssertionError
(
'Expected timeout, got %r'
%
(
result
,
))
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