summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-04-10 19:26:08 +0900
committerLorenzo Colitti <lorenzo@google.com>2015-02-02 17:47:25 +0900
commit0a3a775f4e7fec0c3326a88f9cf709e2ba665e7b (patch)
tree7226c25c17ed01dd36389cc1e516a17a3f757eb0
parent7a743f133a5f6e2a658d82dbcddb88820e03b555 (diff)
downloadextras-0a3a775f4e7fec0c3326a88f9cf709e2ba665e7b.tar.gz
Change the error messages.
Change-Id: Iad59231db7b3ed5e3fb8b757569cc203cec3c7dd
-rwxr-xr-xtests/net_test/mark_test.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/net_test/mark_test.py b/tests/net_test/mark_test.py
index b1075067..9919b830 100755
--- a/tests/net_test/mark_test.py
+++ b/tests/net_test/mark_test.py
@@ -583,14 +583,14 @@ class MarkTest(MultiNetworkTest):
actualtcp.ack = None
actualtcp.chksum = None
- # Serialize the packet so:
- # - Expected packet fields that are only set when a packet is serialized
- # (e.g., the checksum) are filled in.
- # - The packet is vaguely human-readable. Scapy has sophisticated packet
- # dissection capabilities, but unfortunately they can only be used to
- # print the packet, not to return its dissection as as string.
- self.assertMultiLineEqual(str(expected).encode("hex"),
- str(actual).encode("hex"))
+ # Serialize the packet so that expected packet fields that are only set when
+ # a packet is serialized e.g., the checksum) are filled in.
+ expected_real = expected.__class__(str(expected))
+ actual_real = actual.__class__(str(actual))
+ # repr() can be expensive. Call it only if the test is going to fail and we
+ # want to see the error.
+ if expected_real != actual_real:
+ self.assertEquals(repr(expected_real), repr(actual_real))
def PacketMatches(self, expected, actual):
try: