Updated Branches:
  refs/heads/marvin-parallel [created] 6e1c7044e

urllib3 replaces urllib2

urllib2 is replaced with a more threadsafe library urllib3.

    http://urllib3.readthedocs.org/en/latest/index.html

This in combination with Sebastien's threaded-tests patch needs to be
tested. One should ideally be able to drive multiprocess tests as well
with the nose plugin now. WIP commit.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/6e1c7044
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6e1c7044
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6e1c7044

Branch: refs/heads/marvin-parallel
Commit: 6e1c7044ea2534d75e1976eb257faeb980927b73
Parents: 67bd8ae
Author: Prasanna Santhanam <[email protected]>
Authored: Fri Oct 12 18:31:10 2012 +0530
Committer: Prasanna Santhanam <[email protected]>
Committed: Fri Oct 12 18:31:10 2012 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/cloudstackConnection.py |   11 ++++++-----
 tools/marvin/setup.py                       |    5 +++--
 2 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6e1c7044/tools/marvin/marvin/cloudstackConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackConnection.py 
b/tools/marvin/marvin/cloudstackConnection.py
index d70c192..ee05ece 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-import urllib2
+import urllib3
 import urllib
 import httplib
 import base64
@@ -37,6 +37,7 @@ class cloudConnection(object):
         self.mgtSvr = mgtSvr
         self.port = port
         self.logging = logging
+        self.connectionPool = urllib3.PoolManager()
         if port == 8096:
             self.auth = False
         else:
@@ -68,9 +69,9 @@ class cloudConnection(object):
         requestUrl += "&signature=%s"%sig
 
         try:
-            self.connection = 
urllib2.urlopen("http://%s:%d/client/api?%s"%(self.mgtSvr, self.port, 
requestUrl))
+            self.connection = self.connectionPool.request("GET", 
"http://%s:%d/client/api?%s"%(self.mgtSvr, self.port, requestUrl))
             self.logging.debug("sending GET request: %s"%requestUrl)
-            response = self.connection.read()
+            response = self.connection.data
             self.logging.info("got response: %s"%response)
         except IOError, e:
             if hasattr(e, 'reason'):
@@ -94,9 +95,9 @@ class cloudConnection(object):
         requests = zip(requests.keys(), requests.values())
         requestUrl = "&".join(["=".join([request[0], 
urllib.quote_plus(str(request[1]))]) for request in requests])
 
-        self.connection = 
urllib2.urlopen("http://%s:%d/client/api?%s"%(self.mgtSvr, self.port, 
requestUrl))
+        self.connection = self.connectionPool.request("GET", 
"http://%s:%d/client/api?%s"%(self.mgtSvr, self.port, requestUrl))
         self.logging.debug("sending GET request without auth: %s"%requestUrl)
-        response = self.connection.read()
+        response = self.connection.data
         self.logging.info("got response: %s"%response)
         return response
     

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6e1c7044/tools/marvin/setup.py
----------------------------------------------------------------------
diff --git a/tools/marvin/setup.py b/tools/marvin/setup.py
index c9841f3..7c7b4b5 100644
--- a/tools/marvin/setup.py
+++ b/tools/marvin/setup.py
@@ -33,13 +33,14 @@ setup(name="Marvin",
       maintainer_email="[email protected]",
       long_description="Marvin is the cloudstack testclient written around the 
python unittest framework",
       platforms=("Any",),
-      url="http://jenkins.cloudstack.org:8080/job/marvin";,
+      url="http://jenkins.cloudstack.org:8080/job/build-marvin-master";,
       packages=["marvin", "marvin.cloudstackAPI", "marvin.sandbox", 
"marvin.sandbox.advanced", "marvin.sandbox.basic"],
       license="LICENSE.txt",
       install_requires=[
           "pymysql",
           "paramiko",
           "nose",
-          "unittest-xml-reporting"
+          "unittest-xml-reporting",
+          "urllib3",
       ],         
      )

Reply via email to