Skip to content

Commit 5c72735

Browse files
committed
Add mock for sleep function to fasten up testing
1 parent ee06947 commit 5c72735

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/test_player.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ def setUp(self) -> None:
2525
self.mock_virtual_bus = self.MockVirtualBus.return_value
2626
self.mock_virtual_bus.shutdown = Mock()
2727

28+
# Patch time sleep object
29+
patcher_sleep = mock.patch("can.io.player.sleep", spec=True)
30+
self.MockSleep = patcher_sleep.start()
31+
self.addCleanup(patcher_sleep.stop)
32+
2833
self.baseargs = [sys.argv[0], "-i", "virtual"]
2934
self.logfile = os.path.join(
3035
os.path.dirname(__file__), "data", "test_CanMessage.asc"

0 commit comments

Comments
 (0)