Browse Source

Merge #7951: [qa] test_framework: Properly print exception

fada064 [qa] test_framework: Properly print exceptions and assert empty dict (MarcoFalke)
5555528 [qa] mininode: Unfiddle strings into bytes (MarcoFalke)
0.13
MarcoFalke 9 years ago
parent
commit
5c7df7022b
No known key found for this signature in database
GPG Key ID: 2D7F2372E50FE137
  1. 8
      qa/rpc-tests/test_framework/mininode.py
  2. 2
      qa/rpc-tests/test_framework/test_framework.py
  3. 2
      qa/rpc-tests/test_framework/util.py

8
qa/rpc-tests/test_framework/mininode.py

@ -93,7 +93,7 @@ def deser_uint256(f):
def ser_uint256(u): def ser_uint256(u):
rs = "" rs = b""
for i in xrange(8): for i in xrange(8):
rs += struct.pack("<I", u & 0xFFFFFFFFL) rs += struct.pack("<I", u & 0xFFFFFFFFL)
u >>= 32 u >>= 32
@ -191,7 +191,7 @@ def deser_string_vector(f):
def ser_string_vector(l): def ser_string_vector(l):
r = "" r = b""
if len(l) < 253: if len(l) < 253:
r = struct.pack("B", len(l)) r = struct.pack("B", len(l))
elif len(l) < 0x10000: elif len(l) < 0x10000:
@ -624,7 +624,7 @@ class CAlert(object):
self.vchSig = deser_string(f) self.vchSig = deser_string(f)
def serialize(self): def serialize(self):
r = "" r = b""
r += ser_string(self.vchMsg) r += ser_string(self.vchMsg)
r += ser_string(self.vchSig) r += ser_string(self.vchSig)
return r return r
@ -988,7 +988,7 @@ class msg_reject(object):
def __init__(self): def __init__(self):
self.message = b"" self.message = b""
self.code = 0 self.code = 0
self.reason = "" self.reason = b""
self.data = 0L self.data = 0L
def deserialize(self, f): def deserialize(self, f):

2
qa/rpc-tests/test_framework/test_framework.py

@ -146,7 +146,7 @@ class BitcoinTestFramework(object):
print("key not found: "+ str(e)) print("key not found: "+ str(e))
traceback.print_tb(sys.exc_info()[2]) traceback.print_tb(sys.exc_info()[2])
except Exception as e: except Exception as e:
print("Unexpected exception caught during testing: "+str(e)) print("Unexpected exception caught during testing: " + repr(e))
traceback.print_tb(sys.exc_info()[2]) traceback.print_tb(sys.exc_info()[2])
if not self.options.noshutdown: if not self.options.noshutdown:

2
qa/rpc-tests/test_framework/util.py

@ -487,7 +487,7 @@ def assert_array_result(object_array, to_match, expected, should_not_find = Fals
in object_array in object_array
""" """
if should_not_find == True: if should_not_find == True:
expected = { } assert_equal(expected, { })
num_matched = 0 num_matched = 0
for item in object_array: for item in object_array:
all_match = True all_match = True

Loading…
Cancel
Save