fix peer search using inexistent variable, fix test to cover it

This commit is contained in:
Victor Shyba 2019-05-10 14:23:04 -03:00 committed by Jack Robison
parent 7d2f592bb5
commit e59e96190e
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 1 additions and 2 deletions

View file

@ -201,7 +201,6 @@ class Node:
try:
async with peer_generator as junction:
yield junction
await peer_generator.finished.wait()
finally:
if add_hashes_task and not (add_hashes_task.done() or add_hashes_task.cancelled()):
add_hashes_task.cancel()

View file

@ -105,7 +105,7 @@ class TestBlobAnnouncer(AsyncioTestCase):
_, task = last.accumulate_peers(search_q, peer_q)
found_peers = await peer_q.get()
task.cancel()
await task
self.assertEqual(1, len(found_peers))
self.assertEqual(self.node.protocol.node_id, found_peers[0].node_id)