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:
...
@@ -703,6 +703,8 @@ if WIN:
disabled_tests
+=
[
disabled_tests
+=
[
# Issue with Unix vs DOS newlines in the file vs from the server
# Issue with Unix vs DOS newlines in the file vs from the server
'test_ssl.ThreadedTests.test_socketserver'
,
'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
# On appveyor, this sometimes produces 'A non-blocking socket
# operation could not be completed immediately', followed by
# operation could not be completed immediately', followed by
# 'No connection could be made because the target machine
# 'No connection could be made because the target machine
...
...
src/gevent/testing/sysinfo.py
View file @
9184feec
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# 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
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# THE SOFTWARE.
import
errno
import
os
import
os
import
sys
import
sys
...
@@ -135,16 +135,19 @@ EXPECT_POOR_TIMER_RESOLUTION = (
...
@@ -135,16 +135,19 @@ EXPECT_POOR_TIMER_RESOLUTION = (
CONN_ABORTED_ERRORS
=
[]
CONN_ABORTED_ERRORS
=
[]
try
:
def
_make_socket_errnos
(
*
names
):
from
errno
import
WSAECONNABORTED
result
=
[]
CONN_ABORTED_ERRORS
.
append
(
WSAECONNABORTED
)
for
name
in
names
:
except
ImportError
:
try
:
pass
x
=
getattr
(
errno
,
name
)
except
AttributeError
:
from
errno
import
ECONNRESET
pass
CONN_ABORTED_ERRORS
.
append
(
ECONNRESET
)
else
:
result
.
append
(
x
)
CONN_ABORTED_ERRORS
=
frozenset
(
CONN_ABORTED_ERRORS
)
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_ARES
=
os
.
getenv
(
'GEVENT_RESOLVER'
)
==
'ares'
RESOLVER_DNSPYTHON
=
os
.
getenv
(
'GEVENT_RESOLVER'
)
==
'dnspython'
RESOLVER_DNSPYTHON
=
os
.
getenv
(
'GEVENT_RESOLVER'
)
==
'dnspython'
...
...
src/gevent/tests/test__socket_errors.py
View file @
9184feec
...
@@ -21,12 +21,10 @@
...
@@ -21,12 +21,10 @@
import
gevent.testing
as
greentest
import
gevent.testing
as
greentest
from
gevent.testing
import
support
from
gevent.testing
import
support
from
gevent.
socket
import
socket
,
error
from
gevent.
testing
import
sysinfo
try
:
from
gevent.socket
import
socket
,
error
from
errno
import
WSAECONNREFUSED
as
ECONNREFUSED
from
gevent.exceptions
import
LoopExit
except
ImportError
:
from
errno
import
ECONNREFUSED
class
TestSocketErrors
(
greentest
.
TestCase
):
class
TestSocketErrors
(
greentest
.
TestCase
):
...
@@ -35,15 +33,15 @@ class TestSocketErrors(greentest.TestCase):
...
@@ -35,15 +33,15 @@ class TestSocketErrors(greentest.TestCase):
def
test_connection_refused
(
self
):
def
test_connection_refused
(
self
):
port
=
support
.
find_unused_port
()
port
=
support
.
find_unused_port
()
s
=
socket
()
with
socket
()
as
s
:
self
.
_close_on_teardown
(
s
)
try
:
try
:
with
self
.
assertRaises
(
error
)
as
exc
:
s
.
connect
((
greentest
.
DEFAULT_CONNECT_HOST
,
port
))
s
.
connect
((
greentest
.
DEFAULT_CONNECT_HOST
,
port
))
except
error
as
ex
:
except
LoopExit
:
self
.
assertEqual
(
ex
.
args
[
0
],
ECONNREFUSED
,
ex
)
return
self
.
assertIn
(
'refused'
,
str
(
ex
).
lower
())
ex
=
exc
.
exception
else
:
self
.
assertIn
(
ex
.
args
[
0
],
sysinfo
.
CONN_REFUSED_ERRORS
,
ex
)
self
.
fail
(
"Shouldn't have connected"
)
self
.
assertIn
(
'refused'
,
str
(
ex
).
lower
()
)
if
__name__
==
'__main__'
:
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