Skip to content

Commit

Permalink
Fixes faling test_node - /issues/43
Browse files Browse the repository at this point in the history
  • Loading branch information
klpanagi committed Feb 3, 2024
1 parent b39b1b9 commit ec7c1e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion commlib/transports/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ def __init__(self, *args, **kwargs):


class Subscriber(BaseSubscriber):
pass
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._transport = MockTransport(self._conn_params)
11 changes: 10 additions & 1 deletion tests/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import Optional

from commlib.msg import MessageHeader, PubSubMessage, RPCMessage
from commlib.node import Node, TransportType
from commlib.node import Node
from commlib.transports.mock import ConnectionParameters


Expand Down Expand Up @@ -54,3 +54,12 @@ def test_node_create_publisher(self):
node = Node(node_name="sensors.sonar.front", connection_params=self.connparams)
node.create_publisher(msg_type=SonarMessage, topic="sensors.sonar.front")
self.assertTrue(len(node._publishers), 1)

def test_node_create_subscriber(self):
node = Node(node_name="sensors.sonar.front", connection_params=self.connparams)
def on_message(msg):
pass
node.create_subscriber(msg_type=SonarMessage,
topic="sensors.sonar.front",
on_message=on_message)
self.assertTrue(len(node._subscribers), 1)

0 comments on commit ec7c1e2

Please sign in to comment.