Add events in Pubsub

To ensure `handle_peer_queue` and `handle_dead_peer_queue` are indeed
run before the tests finish. Previously, we get errors when performing
`iter_dag` after cancellation. This is because `handle_peer_queue` or
`handle_dead_peer_queue` is not actually run before the Service is
cancelled.
This commit is contained in:
mhchia
2020-01-18 00:17:30 +08:00
parent 54871024cc
commit 6c7aa30191
4 changed files with 16 additions and 1 deletions

View File

@ -106,6 +106,7 @@ async def test_handle_graft(monkeypatch):
async def emit_prune(topic, sender_peer_id):
event_emit_prune.set()
await trio.hazmat.checkpoint()
monkeypatch.setattr(gossipsubs[index_bob], "emit_prune", emit_prune)