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
10429f1a
Commit
10429f1a
authored
Apr 08, 2010
by
Ralf Schmitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some tests for gevent.server
parent
81fa0669
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
0 deletions
+59
-0
greentest/test_server.py
greentest/test_server.py
+59
-0
No files found.
greentest/test_server.py
0 → 100755
View file @
10429f1a
#! /usr/bin/env python
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# 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
os
import
greentest
import
gevent
from
gevent
import
server
,
socket
class
TestFatalErrors
(
greentest
.
TestCase
):
def
setUp
(
self
):
greentest
.
TestCase
.
setUp
(
self
)
self
.
ss
=
server
.
StreamServer
((
"127.0.0.1"
,
0
))
self
.
ss
.
pre_start
()
self
.
socket
=
self
.
ss
.
socket
self
.
ss
.
start
()
def
_joinss
(
self
):
self
.
ss
.
join
(
0.1
)
try
:
self
.
assert_
(
self
.
ss
.
ready
(),
"server did not die"
)
finally
:
self
.
ss
.
kill
()
def
test_socket_shutdown
(
self
):
self
.
socket
.
shutdown
(
socket
.
SHUT_RDWR
)
self
.
_joinss
()
def
test_socket_close
(
self
):
os
.
close
(
self
.
socket
.
fileno
())
self
.
_joinss
()
def
test_socket_file
(
self
):
os
.
close
(
self
.
socket
.
fileno
())
f
=
open
(
"/dev/zero"
,
"r"
)
self
.
_joinss
()
del
f
if
__name__
==
'__main__'
:
greentest
.
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