File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88import ctypes
99import time
1010import logging
11+ import os
1112import unittest
1213from unittest .mock import Mock
1314
@@ -213,12 +214,19 @@ def test_shutdown(self) -> None:
213214 can .interfaces .vector .canlib .xldriver .xlClosePort .assert_called ()
214215 can .interfaces .vector .canlib .xldriver .xlCloseDriver .assert_called ()
215216
216- def test_reset (self ):
217+ def test_reset (self ) -> None :
217218 self .bus = can .Bus (channel = 0 , bustype = "vector" , _testing = True )
218219 self .bus .reset ()
219220 can .interfaces .vector .canlib .xldriver .xlDeactivateChannel .assert_called ()
220221 can .interfaces .vector .canlib .xldriver .xlActivateChannel .assert_called ()
221222
223+ def test_called_without_testing_argument (self ) -> None :
224+ """This tests if an exception is thrown when we are not running on Windows."""
225+ if os .name != "nt" :
226+ with self .assertRaises (OSError ):
227+ # do not set the _testing argument, since it supresses the exception
228+ can .Bus (channel = 0 , bustype = "vector" )
229+
222230
223231def xlGetApplConfig (
224232 app_name_p : ctypes .c_char_p ,
You can’t perform that action at this time.
0 commit comments