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
parent 7abb28cb3e
commit 27afc759ff
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)