diff options
author | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-12-04 23:07:59 -0300 |
---|---|---|
committer | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-12-04 23:07:59 -0300 |
commit | 988c2c6d400b3721464c2891891807d504b076b0 (patch) | |
tree | 013dc3d676edad701d0d3bbd239bc2df0cdf76b4 /lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/tests/server.py | |
parent | 60a1fc6cc4cef0b9eed58ea4f0ca003b76ec382a (diff) | |
parent | 183c4d9cefa95f46c3fa3a6936f837542426eac2 (diff) |
Merge branch 'master' of ssh://gparabola/parabolaweb
Conflicts:
local_settings.py.example
media/archweb.css
packages/templatetags/package_extras.py
public/views.py
templates/packages/details.html
templates/packages/flag.html
templates/packages/flag_confirmed.html
templates/packages/flagged.html
templates/packages/search.html
templates/public/download.html
templates/todolists/view.html
Diffstat (limited to 'lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/tests/server.py')
-rwxr-xr-x | lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/tests/server.py | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/tests/server.py b/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/tests/server.py deleted file mode 100755 index f4aaaa1c..00000000 --- a/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/setuptools/tests/server.py +++ /dev/null @@ -1,48 +0,0 @@ -"""Basic http server for tests to simulate PyPI or custom indexes -""" -import urllib2 -import sys -from threading import Thread -from BaseHTTPServer import HTTPServer -from SimpleHTTPServer import SimpleHTTPRequestHandler - -class IndexServer(HTTPServer): - """Basic single-threaded http server simulating a package index - - You can use this server in unittest like this:: - s = IndexServer() - s.start() - index_url = s.base_url() + 'mytestindex' - # do some test requests to the index - # The index files should be located in setuptools/tests/indexes - s.stop() - """ - def __init__(self): - HTTPServer.__init__(self, ('', 0), SimpleHTTPRequestHandler) - self._run = True - - def serve(self): - while True: - self.handle_request() - if not self._run: break - - def start(self): - self.thread = Thread(target=self.serve) - self.thread.start() - - def stop(self): - """self.shutdown is not supported on python < 2.6""" - self._run = False - try: - if sys.version > '2.6': - urllib2.urlopen('http://127.0.0.1:%s/' % self.server_port, - None, 5) - else: - urllib2.urlopen('http://127.0.0.1:%s/' % self.server_port) - except urllib2.URLError: - pass - self.thread.join() - - def base_url(self): - port = self.server_port - return 'http://127.0.0.1:%s/setuptools/tests/indexes/' % port |