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
7960b8c3
Commit
7960b8c3
authored
Apr 17, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CPython2.7 has only one expected failure now. Fixes test_ares_timeout and test_httpservers.
parent
c8e473aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
2 deletions
+55
-2
gevent/_sslgte279.py
gevent/_sslgte279.py
+7
-1
greentest/2.7/test_httpservers.py
greentest/2.7/test_httpservers.py
+46
-0
greentest/test_ares_timeout.py
greentest/test_ares_timeout.py
+2
-1
No files found.
gevent/_sslgte279.py
View file @
7960b8c3
...
...
@@ -202,9 +202,15 @@ class SSLSocket(socket):
# mixed in.
if
sock
.
getsockopt
(
SOL_SOCKET
,
SO_TYPE
)
!=
SOCK_STREAM
:
raise
NotImplementedError
(
"only stream sockets are supported"
)
socket
.
__init__
(
self
,
_sock
=
sock
)
if
PYPY
:
socket
.
__init__
(
self
,
_sock
=
sock
)
sock
.
_drop
()
else
:
# CPython: XXX: Must pass the underlying socket, not our
# potential wrapper; test___example_servers fails the SSL test
# with a client-side EOF error. (Why?)
socket
.
__init__
(
self
,
_sock
=
sock
.
_sock
)
# The initializer for socket overrides the methods send(), recv(), etc.
# in the instancce, which we don't need -- but we want to provide the
...
...
greentest/2.7/test_httpservers.py
View file @
7960b8c3
...
...
@@ -418,6 +418,8 @@ class CGIHTTPServerTestCase(BaseTestCase):
finally
:
BaseTestCase
.
tearDown
(
self
)
@
unittest
.
skipIf
(
hasattr
(
CGIHTTPServer
,
'_url_collapse_path'
),
"Only on <= 2.7.3"
)
def
test_url_collapse_path_split
(
self
):
test_vectors
=
{
''
:
(
'/'
,
''
),
...
...
@@ -457,6 +459,50 @@ class CGIHTTPServerTestCase(BaseTestCase):
msg
=
'path = %r
\
n
Got: %r
\
n
Wanted: %r'
%
(
path
,
actual
,
expected
))
@
unittest
.
skipIf
(
hasattr
(
CGIHTTPServer
,
'_url_collapse_path_split'
),
"Only on >= 2.7.3"
)
def
test_url_collapse_path
(
self
):
# verify tail is the last portion and head is the rest on proper urls
test_vectors
=
{
''
:
'//'
,
'..'
:
IndexError
,
'/.//..'
:
IndexError
,
'/'
:
'//'
,
'//'
:
'//'
,
'/
\
\
'
:
'//
\
\
'
,
'/.//'
:
'//'
,
'cgi-bin/file1.py'
:
'/cgi-bin/file1.py'
,
'/cgi-bin/file1.py'
:
'/cgi-bin/file1.py'
,
'a'
:
'//a'
,
'/a'
:
'//a'
,
'//a'
:
'//a'
,
'./a'
:
'//a'
,
'./C:/'
:
'/C:/'
,
'/a/b'
:
'/a/b'
,
'/a/b/'
:
'/a/b/'
,
'/a/b/.'
:
'/a/b/'
,
'/a/b/c/..'
:
'/a/b/'
,
'/a/b/c/../d'
:
'/a/b/d'
,
'/a/b/c/../d/e/../f'
:
'/a/b/d/f'
,
'/a/b/c/../d/e/../../f'
:
'/a/b/f'
,
'/a/b/c/../d/e/.././././..//f'
:
'/a/b/f'
,
'../a/b/c/../d/e/.././././..//f'
:
IndexError
,
'/a/b/c/../d/e/../../../f'
:
'/a/f'
,
'/a/b/c/../d/e/../../../../f'
:
'//f'
,
'/a/b/c/../d/e/../../../../../f'
:
IndexError
,
'/a/b/c/../d/e/../../../../f/..'
:
'//'
,
'/a/b/c/../d/e/../../../../f/../.'
:
'//'
,
}
for
path
,
expected
in
test_vectors
.
iteritems
():
if
isinstance
(
expected
,
type
)
and
issubclass
(
expected
,
Exception
):
self
.
assertRaises
(
expected
,
CGIHTTPServer
.
_url_collapse_path
,
path
)
else
:
actual
=
CGIHTTPServer
.
_url_collapse_path
(
path
)
self
.
assertEqual
(
expected
,
actual
,
msg
=
'path = %r
\
n
Got: %r
\
n
Wanted: %r'
%
(
path
,
actual
,
expected
))
def
test_headers_and_content
(
self
):
res
=
self
.
request
(
'/cgi-bin/file1.py'
)
self
.
assertEqual
((
'Hello World
\
n
'
,
'text/html'
,
200
),
...
...
greentest/test_ares_timeout.py
View file @
7960b8c3
from
__future__
import
print_function
import
sys
import
errno
import
gevent
try
:
from
gevent.resolver_ares
import
Resolver
...
...
@@ -14,7 +15,7 @@ listener = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try
:
listener
.
bind
(
address
)
except
socket
.
error
as
ex
:
if
'permission denied'
in
str
(
ex
).
lower
():
if
ex
.
errno
in
(
errno
.
EPERM
,
errno
.
EADDRNOTAVAIL
)
or
'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
...
...
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