py-libp2p/tests/stream_muxer/conftest.py
2019-09-19 16:31:42 +08:00

19 lines
456 B
Python

import asyncio
import pytest
from tests.factories import mplex_conn_pair_factory
@pytest.fixture
async def mplex_conn_pair(is_host_secure):
mplex_conn_0, swarm_0, mplex_conn_1, swarm_1 = await mplex_conn_pair_factory(
is_host_secure
)
assert mplex_conn_0.initiator
assert not mplex_conn_1.initiator
try:
yield mplex_conn_0, mplex_conn_1
finally:
await asyncio.gather(*[swarm_0.close(), swarm_1.close()])