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
9184feec
Commit
9184feec
authored
Jun 03, 2020
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify a test
parent
75d656bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
25 deletions
+28
-25
src/gevent/testing/patched_tests_setup.py
src/gevent/testing/patched_tests_setup.py
+2
-0
src/gevent/testing/sysinfo.py
src/gevent/testing/sysinfo.py
+14
-11
src/gevent/tests/test__socket_errors.py
src/gevent/tests/test__socket_errors.py
+12
-14
No files found.
src/gevent/testing/patched_tests_setup.py
View file @
9184feec
...
...
@@ -703,6 +703,8 @@ if WIN:
disabled_tests
+=
[
# Issue with Unix vs DOS newlines in the file vs from the server
'test_ssl.ThreadedTests.test_socketserver'
,
# This sometimes hangs (only on appveyor)
'test_ssl.ThreadedTests.test_asyncore_server'
,
# On appveyor, this sometimes produces 'A non-blocking socket
# operation could not be completed immediately', followed by
# 'No connection could be made because the target machine
...
...
src/gevent/testing/sysinfo.py
View file @
9184feec
...
...
@@ -17,7 +17,7 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
import
errno
import
os
import
sys
...
...
@@ -135,16 +135,19 @@ EXPECT_POOR_TIMER_RESOLUTION = (
CONN_ABORTED_ERRORS
=
[]
try
:
from
errno
import
WSAECONNABORTED
CONN_ABORTED_ERRORS
.
append
(
WSAECONNABORTED
)
except
ImportError
:
pass
from
errno
import
ECONNRESET
CONN_ABORTED_ERRORS
.
append
(
ECONNRESET
)
CONN_ABORTED_ERRORS
=
frozenset
(
CONN_ABORTED_ERRORS
)
def
_make_socket_errnos
(
*
names
):
result
=
[]
for
name
in
names
:
try
:
x
=
getattr
(
errno
,
name
)
except
AttributeError
:
pass
else
:
result
.
append
(
x
)
return
frozenset
(
result
)
CONN_ABORTED_ERRORS
=
_make_socket_errnos
(
'WSAECONNABORTED'
,
'ECONNRESET'
)
CONN_REFUSED_ERRORS
=
_make_socket_errnos
(
'WSAECONNREFUSED'
,
'ECONNREFUSED'
)
RESOLVER_ARES
=
os
.
getenv
(
'GEVENT_RESOLVER'
)
==
'ares'
RESOLVER_DNSPYTHON
=
os
.
getenv
(
'GEVENT_RESOLVER'
)
==
'dnspython'
...
...
src/gevent/tests/test__socket_errors.py
View file @
9184feec
...
...
@@ -21,12 +21,10 @@
import
gevent.testing
as
greentest
from
gevent.testing
import
support
from
gevent.
socket
import
socket
,
error
from
gevent.
testing
import
sysinfo
try
:
from
errno
import
WSAECONNREFUSED
as
ECONNREFUSED
except
ImportError
:
from
errno
import
ECONNREFUSED
from
gevent.socket
import
socket
,
error
from
gevent.exceptions
import
LoopExit
class
TestSocketErrors
(
greentest
.
TestCase
):
...
...
@@ -35,15 +33,15 @@ class TestSocketErrors(greentest.TestCase):
def
test_connection_refused
(
self
):
port
=
support
.
find_unused_port
()
s
=
socket
()
self
.
_close_on_teardown
(
s
)
try
:
s
.
connect
((
greentest
.
DEFAULT_CONNECT_HOST
,
port
))
except
error
as
ex
:
self
.
assertEqual
(
ex
.
args
[
0
],
ECONNREFUSED
,
ex
)
self
.
assertIn
(
'refused'
,
str
(
ex
).
lower
())
else
:
self
.
fail
(
"Shouldn't have connected"
)
with
socket
()
as
s
:
try
:
with
self
.
assertRaises
(
error
)
as
exc
:
s
.
connect
((
greentest
.
DEFAULT_CONNECT_HOST
,
port
))
except
LoopExit
:
return
ex
=
exc
.
exception
self
.
assertIn
(
ex
.
args
[
0
],
sysinfo
.
CONN_REFUSED_ERRORS
,
ex
)
self
.
assertIn
(
'refused'
,
str
(
ex
).
lower
()
)
if
__name__
==
'__main__'
:
...
...
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