Skip to content

Commit 4de88d2

Browse files
committed
add tiny test for new exception being thrown
1 parent 39af904 commit 4de88d2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

test/test_vector.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import ctypes
99
import time
1010
import logging
11+
import os
1112
import unittest
1213
from 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

223231
def xlGetApplConfig(
224232
app_name_p: ctypes.c_char_p,

0 commit comments

Comments
 (0)