File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def setUp(self) -> None:
23
23
self .MockVirtualBus = patcher_virtual_bus .start ()
24
24
self .addCleanup (patcher_virtual_bus .stop )
25
25
self .mock_virtual_bus = self .MockVirtualBus .return_value
26
- self .mock_virtual_bus .shutdown = Mock ()
26
+ self .mock_virtual_bus .__enter__ = Mock (return_value = self . mock_virtual_bus )
27
27
28
28
# Patch time sleep object
29
29
patcher_sleep = mock .patch ("can.io.player.sleep" , spec = True )
@@ -37,11 +37,12 @@ def setUp(self) -> None:
37
37
38
38
def assertSuccessfullCleanup (self ):
39
39
self .MockVirtualBus .assert_called_once ()
40
+ self .mock_virtual_bus .__exit__ .assert_called_once ()
40
41
41
42
def test_play_virtual (self ):
42
43
sys .argv = self .baseargs + [self .logfile ]
43
44
can .player .main ()
44
- # TODO: add test two messages sent
45
+ self . assertEqual ( self . mock_virtual_bus . send . call_count , 2 )
45
46
self .assertEqual (self .MockSleep .call_count , 2 )
46
47
self .assertSuccessfullCleanup ()
47
48
You can’t perform that action at this time.
0 commit comments