Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
ed54215c
Commit
ed54215c
authored
Jan 01, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use serve_forever and shutdown, now available.
parent
b2d5b933
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
18 deletions
+2
-18
setuptools/tests/server.py
setuptools/tests/server.py
+2
-18
No files found.
setuptools/tests/server.py
View file @
ed54215c
...
...
@@ -23,12 +23,8 @@ class IndexServer(HTTPServer):
HTTPServer
.
__init__
(
self
,
server_address
,
RequestHandlerClass
)
self
.
_run
=
True
def
serve
(
self
):
while
self
.
_run
:
self
.
handle_request
()
def
start
(
self
):
self
.
thread
=
threading
.
Thread
(
target
=
self
.
serve
)
self
.
thread
=
threading
.
Thread
(
target
=
self
.
serve
_forever
)
self
.
thread
.
start
()
def
stop
(
self
):
...
...
@@ -37,19 +33,7 @@ class IndexServer(HTTPServer):
# Let the server finish the last request and wait for a new one.
time
.
sleep
(
0.1
)
# self.shutdown is not supported on python < 2.6, so just
# set _run to false, and make a request, causing it to
# terminate.
self
.
_run
=
False
url
=
'http://127.0.0.1:%(server_port)s/'
%
vars
(
self
)
try
:
if
sys
.
version_info
>=
(
2
,
6
):
urllib2
.
urlopen
(
url
,
timeout
=
5
)
else
:
urllib2
.
urlopen
(
url
)
except
URLError
:
# ignore any errors; all that's important is the request
pass
self
.
shutdown
()
self
.
thread
.
join
()
self
.
socket
.
close
()
...
...
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