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
f5e8061b
Commit
f5e8061b
authored
Jun 10, 2020
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More exception leniency.
parent
68a264e4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
src/gevent/tests/test__socket_dns.py
src/gevent/tests/test__socket_dns.py
+21
-6
No files found.
src/gevent/tests/test__socket_dns.py
View file @
f5e8061b
...
...
@@ -229,7 +229,6 @@ class TestCase(greentest.TestCase):
return getattr(self, norm_name)(result)
return result
NORMALIZE_GAI_IGNORE_CANONICAL_NAME = RESOLVER_ARES # It tends to return them even when not asked for
if not RESOLVER_NOT_SYSTEM:
def _normalize_result_getaddrinfo(self, result):
...
...
@@ -316,8 +315,13 @@ class TestCase(greentest.TestCase):
return
result
def
_compare_exceptions_strict
(
self
,
real_result
,
gevent_result
,
func_name
):
if
repr
(
real_result
)
==
repr
(
gevent_result
):
# Catch things like `OverflowError('port must be 0-65535.',)```
return
msg
=
(
func_name
,
'system:'
,
repr
(
real_result
),
'gevent:'
,
repr
(
gevent_result
))
self
.
assertIs
(
type
(
gevent_result
),
type
(
real_result
),
msg
)
if
isinstance
(
real_result
,
TypeError
):
return
...
...
@@ -335,9 +339,15 @@ class TestCase(greentest.TestCase):
try
:
self
.
_compare_exceptions_strict
(
real_result
,
gevent_result
,
func_name
)
except
AssertionError
:
# Allow
gethostbyaddr/getnameinfo to raise
different things in a few rare cases.
# Allow
raising
different things in a few rare cases.
if
(
func_name
not
in
(
'gethostbyaddr'
,
'getnameinfo'
,
'getaddrinfo'
)
func_name
not
in
(
'getaddrinfo'
,
'gethostbyaddr'
,
'gethostbyname'
,
'gethostbyname_ex'
,
'getnameinfo'
,
)
or
type
(
real_result
)
not
in
(
socket
.
herror
,
socket
.
gaierror
)
or
type
(
gevent_result
)
not
in
(
socket
.
herror
,
socket
.
gaierror
,
socket
.
error
)
):
...
...
@@ -358,8 +368,6 @@ class TestCase(greentest.TestCase):
return
compare_func
(
real_result
,
gevent_result
,
func_name
)
def
_generic_compare_results
(
self
,
real_result
,
gevent_result
,
func_name
):
# if isinstance(real_result, six.string_types):
# return compare_relaxed(real_result, gevent_result)
try
:
if
len
(
real_result
)
!=
len
(
gevent_result
):
return
False
...
...
@@ -404,7 +412,14 @@ class TestCase(greentest.TestCase):
return
not
set
(
real_result
[
2
]).
isdisjoint
(
set
(
gevent_result
[
2
]))
def
assertEqualResults
(
self
,
real_result
,
gevent_result
,
func_name
):
errors
=
(
socket
.
gaierror
,
socket
.
herror
,
TypeError
,
socket
.
error
,
UnicodeError
)
errors
=
(
OverflowError
,
TypeError
,
UnicodeError
,
socket
.
error
,
socket
.
gaierror
,
socket
.
herror
,
)
if
isinstance
(
real_result
,
errors
)
and
isinstance
(
gevent_result
,
errors
):
self
.
_compare_exceptions
(
real_result
,
gevent_result
,
func_name
)
return
...
...
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