qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kgiu...@apache.org
Subject [49/50] [abbrv] qpid-proton git commit: PROTON-490: transport I/O is binary, not str
Date Thu, 18 Jun 2015 20:15:54 GMT
PROTON-490: transport I/O is binary, not str


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/35eb6bb3
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/35eb6bb3
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/35eb6bb3

Branch: refs/heads/kgiusti-python3
Commit: 35eb6bb3332c8965f4fe1434c30517238a52a0bb
Parents: cb59c19
Author: Ken Giusti <kgiusti@apache.org>
Authored: Thu Jun 18 16:09:05 2015 -0400
Committer: Ken Giusti <kgiusti@apache.org>
Committed: Thu Jun 18 16:09:05 2015 -0400

----------------------------------------------------------------------
 tests/python/proton_tests/transport.py | 32 +++++++++++++++--------------
 1 file changed, 17 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/35eb6bb3/tests/python/proton_tests/transport.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/transport.py b/tests/python/proton_tests/transport.py
index dd02c81..07268e1 100644
--- a/tests/python/proton_tests/transport.py
+++ b/tests/python/proton_tests/transport.py
@@ -90,11 +90,11 @@ class ClientTransportTest(Test):
     self.assert_error(u'amqp:connection:framing-error')
 
   def testProtocolNotSupported(self):
-    self.transport.push("AMQP\x01\x01\x0a\x00")
+    self.transport.push(str2bin("AMQP\x01\x01\x0a\x00"))
     p = self.transport.pending()
     assert p >= 8, p
     bytes = self.transport.peek(p)
-    assert bytes[:8] == "AMQP\x00\x01\x00\x00"
+    assert bytes[:8] == str2bin("AMQP\x00\x01\x00\x00")
     self.transport.pop(p)
     self.drain()
     assert self.transport.closed
@@ -214,29 +214,29 @@ class ServerTransportTest(Test):
 
   # TODO: This may no longer be testing anything
   def testEOS(self):
-    self.transport.push("") # should be a noop
+    self.transport.push(str2bin("")) # should be a noop
     self.transport.close_tail()
     p = self.transport.pending()
     self.drain()
     assert self.transport.closed
 
   def testPartial(self):
-    self.transport.push("AMQ") # partial header
+    self.transport.push(str2bin("AMQ")) # partial header
     self.transport.close_tail()
     p = self.transport.pending()
     assert p >= 8, p
     bytes = self.transport.peek(p)
-    assert bytes[:8] == "AMQP\x00\x01\x00\x00"
+    assert bytes[:8] == str2bin("AMQP\x00\x01\x00\x00")
     self.transport.pop(p)
     self.drain()
     assert self.transport.closed
 
   def testGarbage(self, garbage="GARBAGE_"):
-    self.transport.push(garbage)
+    self.transport.push(str2bin(garbage))
     p = self.transport.pending()
     assert p >= 8, p
     bytes = self.transport.peek(p)
-    assert bytes[:8] == "AMQP\x00\x01\x00\x00"
+    assert bytes[:8] == str2bin("AMQP\x00\x01\x00\x00")
     self.transport.pop(p)
     self.drain()
     assert self.transport.closed
@@ -248,16 +248,16 @@ class ServerTransportTest(Test):
     self.testGarbage("GARBAGE_XXX")
 
   def testHeader(self):
-    self.transport.push("AMQP\x00\x01\x00\x00")
+    self.transport.push(str2bin("AMQP\x00\x01\x00\x00"))
     self.transport.close_tail()
     self.assert_error(u'amqp:connection:framing-error')
 
   def testProtocolNotSupported(self):
-    self.transport.push("AMQP\x01\x01\x0a\x00")
+    self.transport.push(str2bin("AMQP\x01\x01\x0a\x00"))
     p = self.transport.pending()
     assert p >= 8, p
     bytes = self.transport.peek(p)
-    assert bytes[:8] == "AMQP\x00\x01\x00\x00"
+    assert bytes[:8] == str2bin("AMQP\x00\x01\x00\x00")
     self.transport.pop(p)
     self.drain()
     assert self.transport.closed
@@ -276,8 +276,8 @@ class ServerTransportTest(Test):
     trn = Transport()
     trn.bind(conn)
     out = trn.peek(1024)
-    assert "test-container" in out, repr(out)
-    assert "test-hostname" in out, repr(out)
+    assert str2bin("test-container") in out, repr(out)
+    assert str2bin("test-hostname") in out, repr(out)
     self.transport.push(out)
 
     c = Connection()
@@ -294,7 +294,8 @@ class ServerTransportTest(Test):
     assert n >= 0, n
     try:
       self.transport.close_head()
-    except TransportException, e:
+    except TransportException:
+      e = sys.exc_info()[1]
       assert "aborted" in str(e), str(e)
     n = self.transport.pending()
     assert n < 0, n
@@ -304,7 +305,8 @@ class ServerTransportTest(Test):
     assert n > 0, n
     try:
       self.transport.close_tail()
-    except TransportException, e:
+    except TransportException:
+      e = sys.exc_info()[1]
       assert "aborted" in str(e), str(e)
     n = self.transport.capacity()
     assert n < 0, n
@@ -332,7 +334,7 @@ class ServerTransportTest(Test):
     self.transport.pop(len(dat2) - len(dat1))
     dat3 = self.transport.peek(1024)
     self.transport.pop(len(dat3))
-    assert self.transport.peek(1024) == ""
+    assert self.transport.peek(1024) == str2bin("")
 
     self.peer.push(dat1)
     self.peer.push(dat2[len(dat1):])


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message