mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
WIP CI Build Errors (#76)
* ignore TODO and kademlia * remove unnecessary pass * fixed swarm warnings * fixed peerdata_interface warnings * fixed peer warnings * fixed rest of linting errors * trying to fix last error * fixed dup errors
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
import pytest
|
||||
|
||||
from libp2p.libp2p import *
|
||||
from libp2p.libp2p import new_node
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_simple_messages():
|
||||
hostA = await new_node(transport_opt=["/ip4/127.0.0.1/tcp/8001/ipfs/hostA"])
|
||||
hostB = await new_node(transport_opt=["/ip4/127.0.0.1/tcp/8000/ipfs/hostB"])
|
||||
node_a = await new_node(transport_opt=["/ip4/127.0.0.1/tcp/8001/ipfs/node_a"])
|
||||
node_b = await new_node(transport_opt=["/ip4/127.0.0.1/tcp/8000/ipfs/node_b"])
|
||||
|
||||
async def stream_handler(stream):
|
||||
while True:
|
||||
@ -16,12 +16,12 @@ async def test_simple_messages():
|
||||
print("sending response:" + response)
|
||||
await stream.write(response.encode())
|
||||
|
||||
hostB.set_stream_handler("/echo/1.0.0", stream_handler)
|
||||
node_b.set_stream_handler("/echo/1.0.0", stream_handler)
|
||||
|
||||
# Associate the peer with local ip address (see default parameters of Libp2p())
|
||||
hostA.get_peerstore().add_addr("hostB", "/ip4/127.0.0.1/tcp/8000", 10)
|
||||
node_a.get_peerstore().add_addr("node_b", "/ip4/127.0.0.1/tcp/8000", 10)
|
||||
|
||||
stream = await hostA.new_stream("hostB", "/echo/1.0.0")
|
||||
stream = await node_a.new_stream("node_b", "/echo/1.0.0")
|
||||
messages = ["hello" + str(x) for x in range(10)]
|
||||
|
||||
for message in messages:
|
||||
|
||||
@ -12,7 +12,8 @@ async def handle_echo(reader, writer):
|
||||
writer.close()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
# TODO: this test should develop out into a fuller test between MPlex modules communicating with each other.
|
||||
# TODO: this test should develop out into a fuller test between MPlex
|
||||
# modules communicating with each other.
|
||||
async def test_simple_echo():
|
||||
server_ip = '127.0.0.1'
|
||||
server_port = 8888
|
||||
|
||||
@ -5,7 +5,6 @@ from peer.peerstore import PeerStore
|
||||
|
||||
# Testing methods from IPeerMetadata base class.
|
||||
|
||||
|
||||
def test_get_empty():
|
||||
with pytest.raises(PeerStoreError):
|
||||
store = PeerStore()
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
import pytest
|
||||
|
||||
from peer.peerstore import PeerStoreError
|
||||
from peer.peerstore import PeerStore
|
||||
|
||||
# Testing methods from IPeerStore base class.
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import pytest
|
||||
|
||||
# pylint: disable=eval-used
|
||||
|
||||
@pytest.mark.parametrize("test_input,expected", [
|
||||
("3+5", 8),
|
||||
("2+4", 6),
|
||||
|
||||
Reference in New Issue
Block a user