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
fd0828ab
Commit
fd0828ab
authored
Jul 01, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A failing test for #597
parent
39ce024e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
9 deletions
+66
-9
gevent/_ssl3.py
gevent/_ssl3.py
+2
-2
greentest/test___example_servers.py
greentest/test___example_servers.py
+36
-3
greentest/util.py
greentest/util.py
+18
-4
known_failures.py
known_failures.py
+10
-0
No files found.
gevent/_ssl3.py
View file @
fd0828ab
...
...
@@ -142,8 +142,8 @@ class SSLSocket(socket):
raise
x
def
dup
(
self
):
raise
NotImplemented
(
"Can't dup() %s instances"
%
self
.
__class__
.
__name__
)
raise
NotImplemented
Error
(
"Can't dup() %s instances"
%
self
.
__class__
.
__name__
)
def
_checkClosed
(
self
,
msg
=
None
):
# raise an exception here if you wish to check for spurious closes
...
...
greentest/test___example_servers.py
View file @
fd0828ab
...
...
@@ -7,23 +7,25 @@ else:
import
urllib2
import
util
import
socket
import
ssl
class
Test_wsgiserver
(
util
.
TestServer
):
server
=
'wsgiserver.py'
URL
=
'http://127.0.0.1:8088'
PORT
=
8088
not_found_message
=
b'<h1>Not Found</h1>'
ssl_ctx
=
None
_use_ssl
=
False
def
read
(
self
,
path
=
'/'
):
url
=
self
.
URL
+
path
try
:
if
self
.
ssl_ctx
is
not
None
:
response
=
urllib2
.
urlopen
(
url
,
context
=
self
.
ssl_ctx
)
response
=
urllib2
.
urlopen
(
url
,
None
,
2
,
context
=
self
.
ssl_ctx
)
else
:
response
=
urllib2
.
urlopen
(
url
)
response
=
urllib2
.
urlopen
(
url
,
None
,
2
)
except
urllib2
.
HTTPError
:
response
=
sys
.
exc_info
()[
1
]
result
=
'%s %s'
%
(
response
.
code
,
response
.
msg
),
response
.
read
()
...
...
@@ -42,10 +44,41 @@ class Test_wsgiserver(util.TestServer):
self
.
assertEqual
(
status
,
'404 Not Found'
)
self
.
assertEqual
(
data
,
self
.
not_found_message
)
def
test_a_blocking_client
(
self
):
with
self
.
running_server
():
# First, make sure we can talk to it.
self
.
_test_hello
()
# Now create a connection and only partway finish
# the transaction
sock
=
socket
.
create_connection
((
'127.0.0.1'
,
self
.
PORT
))
ssl_sock
=
None
if
self
.
_use_ssl
:
ssl_sock
=
ssl
.
wrap_socket
(
sock
)
sock_file
=
ssl_sock
.
makefile
(
mode
=
'rwb'
)
else
:
sock_file
=
sock
.
makefile
(
mode
=
'rwb'
)
sock_file
.
write
(
b'GET /xxx HTTP/1.0
\
r
\
n
\
r
\
n
'
)
sock_file
.
flush
()
# Leave it open and not doing anything
# while the other request runs to completion.
# This demonstrates that a blocking client
# doesn't hang the whole server
self
.
_test_hello
()
line
=
sock_file
.
readline
()
self
.
assertEqual
(
line
,
b'HTTP/1.1 404 Not Found
\
r
\
n
'
)
sock
.
close
()
sock_file
.
close
()
if
ssl_sock
is
not
None
:
ssl_sock
.
close
()
class
Test_wsgiserver_ssl
(
Test_wsgiserver
):
server
=
'wsgiserver_ssl.py'
URL
=
'https://127.0.0.1:8443'
PORT
=
8443
_use_ssl
=
True
if
hasattr
(
ssl
,
'_create_unverified_context'
):
# Disable verification for our self-signed cert
...
...
greentest/util.py
View file @
fd0828ab
...
...
@@ -212,13 +212,27 @@ class TestServer(unittest.TestCase):
args
=
[]
before_delay
=
3
after_delay
=
0.5
popen
=
None
server
=
None
# subclasses define this to be the path to the server.py
def
start
(
self
):
return
start
([
sys
.
executable
,
'-u'
,
self
.
server
]
+
self
.
args
,
cwd
=
self
.
cwd
)
def
running_server
(
self
):
from
contextlib
import
contextmanager
@
contextmanager
def
running_server
():
with
self
.
start
()
as
popen
:
self
.
popen
=
popen
self
.
before
()
yield
self
.
after
()
return
running_server
()
def
test
(
self
):
with
start
([
sys
.
executable
,
'-u'
,
self
.
server
]
+
self
.
args
,
cwd
=
self
.
cwd
)
as
popen
:
self
.
popen
=
popen
self
.
before
()
with
self
.
running_server
():
self
.
_run_all_tests
()
self
.
after
()
def
before
(
self
):
if
self
.
before_delay
is
not
None
:
...
...
known_failures.py
View file @
fd0828ab
...
...
@@ -8,6 +8,11 @@ import sys
LEAKTEST
=
os
.
getenv
(
'GEVENTTEST_LEAKCHECK'
)
PYPY
=
hasattr
(
sys
,
'pypy_version_info'
)
PY3
=
sys
.
version_info
[
0
]
>=
3
PYGTE279
=
(
sys
.
version_info
[
0
]
==
2
and
sys
.
version_info
[
1
]
>=
7
and
sys
.
version_info
[
2
]
>=
9
)
FAILING_TESTS
=
[
...
...
@@ -80,6 +85,11 @@ if PYPY:
'test_socket.py'
,
]
if
PYGTE279
or
PY3
:
FAILING_TESTS
+=
[
# SSL is blocking; see https://github.com/gevent/gevent/issues/597
'test___example_servers.py'
]
if
PY3
:
# No idea / TODO
...
...
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