You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2007/03/07 00:35:09 UTC

svn commit: r515363 - in /incubator/qpid/branches/qpid.0-9/python/qpid: peer.py spec.py testlib.py

Author: aconway
Date: Tue Mar  6 15:35:08 2007
New Revision: 515363

URL: http://svn.apache.org/viewvc?view=rev&rev=515363
Log:
* python/qpid/peer.py (Channel.__init__): use reliable framing if
  version >= 0-8.
* python/qpid/spec.py (Spec.__init__): Remove unused parameter.
* python/qpid/testlib.py (TestRunner._parseargs): Add --errata option,
  set default errata only if --spec is not present.

Modified:
    incubator/qpid/branches/qpid.0-9/python/qpid/peer.py
    incubator/qpid/branches/qpid.0-9/python/qpid/spec.py
    incubator/qpid/branches/qpid.0-9/python/qpid/testlib.py

Modified: incubator/qpid/branches/qpid.0-9/python/qpid/peer.py
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/qpid/peer.py?view=diff&rev=515363&r1=515362&r2=515363
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/qpid/peer.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/qpid/peer.py Tue Mar  6 15:35:08 2007
@@ -183,8 +183,8 @@
     self.requester = Requester(self.write)
     self.responder = Responder(self.write)
 
-    # XXX: better switch
-    self.reliable = True
+    # Use reliable framing if version >= 0-9.
+    self.reliable = (spec.major >= 0 and spec.minor >= 9)
     self.synchronous = True
 
   def close(self, reason):

Modified: incubator/qpid/branches/qpid.0-9/python/qpid/spec.py
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/qpid/spec.py?view=diff&rev=515363&r1=515362&r2=515363
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/qpid/spec.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/qpid/spec.py Tue Mar  6 15:35:08 2007
@@ -79,12 +79,11 @@
 
   PRINT=["major", "minor", "file"]
 
-  def __init__(self, major, minor, file, errata):
+  def __init__(self, major, minor, file):
     Metadata.__init__(self)
     self.major = major
     self.minor = minor
     self.file = file
-    self.errata = errata
     self.constants = SpecContainer()
     self.classes = SpecContainer()
     # methods indexed by classname_methname
@@ -275,7 +274,7 @@
 def load(specfile, *errata):
   doc = xmlutil.parse(specfile)
   spec_root = doc["amqp"][0]
-  spec = Spec(int(spec_root["@major"]), int(spec_root["@minor"]), specfile, errata)
+  spec = Spec(int(spec_root["@major"]), int(spec_root["@minor"]), specfile)
 
   for root in [spec_root] + map(lambda x: xmlutil.parse(x)["amqp"][0], errata):
     # constants

Modified: incubator/qpid/branches/qpid.0-9/python/qpid/testlib.py
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/qpid/testlib.py?view=diff&rev=515363&r1=515362&r2=515363
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/qpid/testlib.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/qpid/testlib.py Tue Mar  6 15:35:08 2007
@@ -57,13 +57,14 @@
 run-tests [options] [test*]
 The name of a test is package.module.ClassName.testMethod
 Options:
-  -?/-h/--help         : this message
-  -s/--spec <spec.xml> : file containing amqp XML spec 
+  -?/-h/--help             : this message
+  -s/--spec <spec.xml>     : file containing amqp XML spec
+  -e/--errata <errata.xml> : file containing amqp XML errata
   -b/--broker [<user>[/<password>]@]<host>[:<port>] : broker to connect to
-  -v/--verbose         : verbose - lists tests as they are run.
-  -d/--debug           : enable debug logging.
-  -i/--ignore <test>   : ignore the named test.
-  -I/--ignore-file     : file containing patterns to ignore.
+  -v/--verbose             : verbose - lists tests as they are run.
+  -d/--debug               : enable debug logging.
+  -i/--ignore <test>       : ignore the named test.
+  -I/--ignore-file         : file containing patterns to ignore.
   """
         sys.exit(1)
 
@@ -81,10 +82,10 @@
     def __init__(self):
         # Defaults
         self.setBroker("localhost")
-        self.spec = "../specs/amqp.0-9.xml"
-        self.errata = "../specs/amqp-errata.0-9.xml"
         self.verbose = 1
         self.ignore = []
+        self.spec = None
+        self.errata = []
 
     def ignoreFile(self, filename):
         f = file(filename)
@@ -99,12 +100,20 @@
         for opt, value in opts:
             if opt in ("-?", "-h", "--help"): self._die()
             if opt in ("-s", "--spec"): self.spec = value
+            if opt in ("-e", "--errata"): self.errata.append(value)
             if opt in ("-b", "--broker"): self.setBroker(value)
             if opt in ("-v", "--verbose"): self.verbose = 2
             if opt in ("-d", "--debug"): logging.basicConfig(level=logging.DEBUG)
             if opt in ("-i", "--ignore"): self.ignore.append(value)
             if opt in ("-I", "--ignore-file"): self.ignoreFile(value)
 
+        # Default spec and errata.
+        if (self.spec == None):
+            if (len(self.errata)>0):
+                self._die("Specified errata with no spec.")
+            self.spec = "../specs/amqp.0-9.xml"
+            self.errata = ["../specs/amqp-errata.0-9.xml"]
+        # Default to running all tests.
         if len(self.tests) == 0: self.tests=findmodules("tests")
 
     def testSuite(self):
@@ -142,7 +151,7 @@
         errata = errata or self.errata
         user = user or self.user
         password = password or self.password
-        client = qpid.client.Client(host, port, qpid.spec.load(spec, errata))
+        client = qpid.client.Client(host, port, qpid.spec.load(spec, *errata))
         client.start({"LOGIN": user, "PASSWORD": password}, tune_params=tune_params)
         return client