Skip to content

Commit 1aaa4b2

Browse files
committed
BufferedListener test doesn't need to use a bus.
1 parent 9b809d0 commit 1aaa4b2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

can/CAN.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ def on_message_received(self, msg):
6868
def get_message(self, timeout=0.5):
6969
"""
7070
Attempts to retrieve the latest message received by the instance. If no message is
71-
available it blocks for 0.5 seconds or until a message is received (whichever
72-
is shorter), and returns the message if there is one, or None if there is not.
71+
available it blocks for given timeout or until a message is received (whichever
72+
is shorter),
73+
74+
:param float timeout: The number of seconds to wait for a new message.
75+
:return: the :class:`~can.Message` if there is one, or None if there is not.
7376
"""
7477
try:
7578
return self.buffer.get(block=True, timeout=timeout)

test/listener_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@ def testLogger(self):
4646

4747
def testBufferedListenerReceives(self):
4848
a_listener = can.BufferedReader()
49-
notifier = can.Notifier(self.bus, [a_listener], 0.1)
50-
self.bus.send(generate_message(0xDADADA))
49+
a_listener(generate_message(0xDADADA))
5150
m = a_listener.get_message(0.2)
5251
self.assertIsNotNone(m)
53-
notifier.stop()
5452

5553
def testAscListener(self):
5654
a_listener = can.ASCWriter("test.asc")

0 commit comments

Comments
 (0)