Skip to content

Commit f5d5949

Browse files
committed
Cleanup loopback tests
1 parent 248c221 commit f5d5949

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

canalystii/device.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,6 @@ def receive(self, channel):
244244
channel, self.COMMAND_MESSAGE_STATUS, protocol.MessageStatusResponse
245245
)
246246

247-
print(status.unknown)
248-
249247
if status.rx_pending == 0:
250248
return []
251249

tests/loopback_tests.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import canalystii
2+
import gc
23
import pytest
34
import struct
45

56

6-
@pytest.fixture(scope="session") # TODO: figure out how to properly GC these
7+
@pytest.fixture()#scope="session") # TODO: figure out how to properly GC these
78
def device():
9+
gc.collect()
810
dev = canalystii.CanalystDevice(bitrate=1000000)
911
dev.clear_rx_buffer(0)
1012
dev.clear_rx_buffer(1)
@@ -115,7 +117,8 @@ def test_stop_receiver(device):
115117
device.stop(1)
116118

117119
assert device.send(0, msg0, 0.1)
118-
assert not device.receive(1)
120+
with pytest.raises(RuntimeError):
121+
device.receive(1)
119122

120123
device.start(1)
121124

@@ -131,7 +134,8 @@ def test_stop_sender(device):
131134

132135
device.stop(0)
133136

134-
assert device.send(0, msg0, 0.1)
137+
with pytest.raises(RuntimeError):
138+
device.send(0, msg0, 0.1)
135139
assert not device.receive(1)
136140

137141
device.start(0)

0 commit comments

Comments
 (0)