summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexis Metaireau <ametaireau@gmail.com>2010-08-06 17:05:59 +0200
committerAlexis Metaireau <ametaireau@gmail.com>2010-08-06 17:05:59 +0200
commited79b31dcfa0b0d01d9c440c8ca3d5da79e216e9 (patch)
tree0e39bace4eee983d23bf760a15b739dbcee65079 /src
parent22583e5d4c1f2265cdceca537adc558403fa488e (diff)
downloaddisutils2-ed79b31dcfa0b0d01d9c440c8ca3d5da79e216e9.tar.gz
Document a bit the sources of the pypi mock server.
Mocked distributions now provides automatically the distribution name + version.
Diffstat (limited to 'src')
-rw-r--r--src/distutils2/tests/pypi_server.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/distutils2/tests/pypi_server.py b/src/distutils2/tests/pypi_server.py
index b708d27..55312d9 100644
--- a/src/distutils2/tests/pypi_server.py
+++ b/src/distutils2/tests/pypi_server.py
@@ -3,6 +3,30 @@
This module also provides a simple test case to extend if you need to use
the PyPIServer all along your test case. Be sure to read the documentation
before any use.
+
+XXX TODO:
+
+The mock server can handle simple HTTP request (to simulate a simple index) or
+XMLRPC requests, over HTTP. Both does not have the same intergface to deal
+with, and I think it's a pain.
+
+A good idea could be to re-think a bit the way dstributions are handled in the
+mock server. As it should return malformed HTML pages, we need to keep the
+static behavior.
+
+I think of something like that:
+
+ >>> server = PyPIMockServer()
+ >>> server.startHTTP()
+ >>> server.startXMLRPC()
+
+Then, the server must have only one port to rely on, eg.
+
+ >>> server.fulladress()
+ "http://ip:port/"
+
+It could be simple to have one HTTP server, relaying the requests to the two
+implementations (static HTTP and XMLRPC over HTTP).
"""
import Queue
@@ -79,7 +103,8 @@ class PyPIServer(threading.Thread):
threading.Thread.__init__(self)
self._run = True
self._serve_xmlrpc = serve_xmlrpc
-
+
+ #TODO allow to serve XMLRPC and HTTP static files at the same time.
if not self._serve_xmlrpc:
self.server = HTTPServer(('', 0), PyPIRequestHandler)
self.server.RequestHandlerClass.pypi_server = self
@@ -97,7 +122,7 @@ class PyPIServer(threading.Thread):
self.static_filesystem_paths = [PYPI_DEFAULT_STATIC_PATH + "/" + path
for path in static_filesystem_paths]
else:
- # xmlrpc server
+ # XMLRPC server
self.server = PyPIXMLRPCServer(('', 0))
self.xmlrpc = XMLRPCMockIndex()
# register the xmlrpc methods
@@ -331,7 +356,8 @@ class MockDist(object):
'summary': self.summary,
'home_page': self.homepage,
'stable_version': self.stable_version,
- 'provides_dist': self.provides_dist,
+ 'provides_dist': self.provides_dist or "%s (%s)" % (self.name,
+ self.version),
'requires': self.requires,
'cheesecake_installability_id': self.cheesecake_installability_id,
}