2019-09-09 16:58:58 +08:00
|
|
|
import pytest
|
|
|
|
|
2019-11-21 11:47:54 +08:00
|
|
|
from libp2p.tools.factories import (
|
2019-09-17 23:38:11 +08:00
|
|
|
net_stream_pair_factory,
|
|
|
|
swarm_conn_pair_factory,
|
|
|
|
swarm_pair_factory,
|
|
|
|
)
|
2019-09-09 16:58:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2020-02-19 23:15:03 +08:00
|
|
|
async def net_stream_pair(security_protocol):
|
|
|
|
async with net_stream_pair_factory(
|
|
|
|
security_protocol=security_protocol
|
|
|
|
) as net_stream_pair:
|
2019-11-26 19:24:30 +08:00
|
|
|
yield net_stream_pair
|
2019-09-14 23:37:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2020-02-19 23:15:03 +08:00
|
|
|
async def swarm_pair(security_protocol):
|
|
|
|
async with swarm_pair_factory(security_protocol=security_protocol) as swarms:
|
2019-11-26 19:24:30 +08:00
|
|
|
yield swarms
|
2019-09-17 23:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2020-02-19 23:15:03 +08:00
|
|
|
async def swarm_conn_pair(security_protocol):
|
|
|
|
async with swarm_conn_pair_factory(
|
|
|
|
security_protocol=security_protocol
|
|
|
|
) as swarm_conn_pair:
|
2019-11-26 19:24:30 +08:00
|
|
|
yield swarm_conn_pair
|