Skip to content

Commit

Permalink
minor bug fixing.
Browse files Browse the repository at this point in the history
  • Loading branch information
javipalanca committed Jul 5, 2018
1 parent 4b76b6f commit 084b0ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_behaviour.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
STATE_THREE = "STATE_THREE"


def wait_for_event(event, loop, tries=5000, sleep=0.001):
def wait_for_event(event, loop, tries=5000, sleep=0.01):
counter = 0
future = asyncio.run_coroutine_threadsafe(event.wait(), loop=loop)
while not event.is_set() and not future.done() and counter < tries:
while (not event.is_set()) and (not future.done()) and (counter < tries):
try:
future.result(sleep)
except asyncio.TimeoutError:
Expand Down Expand Up @@ -271,7 +271,7 @@ def test_receive():
class RecvBehaviour(OneShotBehaviour):
async def run(self):
msg = Message(body="received body")
await asyncio.wait_for(self.queue.put(msg), 0.1)
await asyncio.wait_for(self.queue.put(msg), 5.0)
self.agent.recv_msg = await self.receive()
self.agent.wait_behaviour.set()

Expand All @@ -296,7 +296,7 @@ async def run(self):
def test_receive_with_timeout():
class RecvBehaviour(OneShotBehaviour):
async def run(self):
self.agent.recv_msg = await self.receive(1)
self.agent.recv_msg = await self.receive(5.0)
self.agent.wait_behaviour.set()

agent = make_connected_agent()
Expand Down

0 comments on commit 084b0ba

Please sign in to comment.