Skip to content

Commit 4739391

Browse files
committed
add test and correct type annotations
1 parent c56ff40 commit 4739391

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

can/interfaces/vector/canlib.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
HAS_EVENTS = True
2121
except ImportError:
22+
WaitForSingleObject, INFINITE = None, None
2223
HAS_EVENTS = False
2324

2425
# Import Modules
@@ -67,12 +68,12 @@ def __init__(
6768
channel: Union[int, Sequence[int], str],
6869
can_filters: Optional[CanFilters] = None,
6970
poll_interval: float = 0.01,
70-
receive_own_messages: Optional[bool] = False,
71+
receive_own_messages: bool = False,
7172
bitrate: Optional[int] = None,
7273
rx_queue_size: int = 2 ** 14,
7374
app_name: Optional[str] = "CANalyzer",
7475
serial: Optional[int] = None,
75-
fd: Optional[bool] = False,
76+
fd: bool = False,
7677
data_bitrate: Optional[int] = None,
7778
sjw_abr: int = 2,
7879
tseg1_abr: int = 6,

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ exclude =
1414
venv
1515
|^test
1616
|^setup.py$
17+
|^can/interfaces/__init__.py
1718
|^can/interfaces/etas
1819
|^can/interfaces/gs_usb
1920
|^can/interfaces/ics_neovi

test/test_vector.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
VectorOperationError,
2323
VectorChannelConfig,
2424
)
25+
from test.config import IS_WINDOWS
2526

2627

2728
class TestVectorBus(unittest.TestCase):
@@ -328,6 +329,11 @@ def test_vector_subtype_error_from_generic(self) -> None:
328329
with pytest.raises(error_type):
329330
raise specific
330331

332+
@unittest.skipUnless(IS_WINDOWS, "Windows specific test")
333+
def test_winapi_availability(self) -> None:
334+
self.assertIsNotNone(canlib.WaitForSingleObject)
335+
self.assertIsNotNone(canlib.INFINITE)
336+
331337

332338
class TestVectorChannelConfig:
333339
def test_attributes(self):

0 commit comments

Comments
 (0)