Skip to content

Commit

Permalink
Fix deprecation warnings (#870)
Browse files Browse the repository at this point in the history
* msgpack encoding arg is deprecated, use raw=False instead

* fix assert warnings from py3 tests
  • Loading branch information
cgoldberg authored Sep 1, 2018
1 parent 6701f70 commit 70d2647
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions locust/rpc/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ def __init__(self, message_type, data, node_id):
self.type = message_type
self.data = data
self.node_id = node_id

def serialize(self):
return msgpack.dumps((self.type, self.data, self.node_id))

@classmethod
def unserialize(cls, data):
msg = cls(*msgpack.loads(data, encoding='utf-8'))
msg = cls(*msgpack.loads(data, raw=False))
return msg
10 changes: 5 additions & 5 deletions locust/test/test_task_sequence_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MyTaskSequence(TaskSequence):
tasks = [t1, t2, t3]

l = MyTaskSequence(self.locust)

self.assertRaises(RescheduleTask, lambda: l.run())
self.assertTrue(l.t1_executed)
self.assertTrue(l.t2_executed)
Expand All @@ -48,7 +48,7 @@ class MyTaskSequence(TaskSequence):
t1_executed = 0
t2_executed = 0
t3_executed = 0

@seq_task(1)
def t1(self):
if self._index == 1:
Expand All @@ -69,6 +69,6 @@ def t3(self):
l = MyTaskSequence(self.locust)

self.assertRaises(RescheduleTask, lambda: l.run())
self.assertEquals(l.t1_executed, 1)
self.assertEquals(l.t2_executed, 3)
self.assertEquals(l.t3_executed, 1)
self.assertEqual(l.t1_executed, 1)
self.assertEqual(l.t2_executed, 3)
self.assertEqual(l.t3_executed, 1)

0 comments on commit 70d2647

Please sign in to comment.