mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Add test for host connect and disconnect
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
import asyncio
|
||||
import sys
|
||||
|
||||
import pexpect
|
||||
import pytest
|
||||
|
||||
from .daemon import make_p2pd
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def proc_factory():
|
||||
@ -22,3 +25,19 @@ def proc_factory():
|
||||
finally:
|
||||
for proc in procs:
|
||||
proc.close()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def num_p2pds():
|
||||
return 1
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def p2pds(num_p2pds, is_host_secure, unused_tcp_port_factory):
|
||||
p2pds = await asyncio.gather(
|
||||
*[make_p2pd(unused_tcp_port_factory, is_host_secure) for _ in range(num_p2pds)]
|
||||
)
|
||||
try:
|
||||
yield p2pds
|
||||
finally:
|
||||
await asyncio.gather(*[p2pd.close() for p2pd in p2pds])
|
||||
|
||||
Reference in New Issue
Block a user