Skip to content

Commit f1c5c0b

Browse files
committed
Log warning instead of raise error when pcan api is to old
1 parent 0ee529c commit f1c5c0b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

can/interfaces/pcan/pcan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def get_api_version(self):
322322
def check_api_version(self):
323323
apv = self.get_api_version()
324324
if apv < MIN_PCAN_API_VERSION:
325-
raise CanInitializationError(
325+
log.warning(
326326
f"Minimum version of pcan api is {MIN_PCAN_API_VERSION}."
327327
f" Installed version is {apv}. Consider upgrade of pcan basic package"
328328
)

test/test_pcan.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ def test_bus_creation_fd(self) -> None:
6666
self.mock_pcan.Initialize.assert_not_called()
6767
self.mock_pcan.InitializeFD.assert_called_once()
6868

69-
def test_api_version_error(self) -> None:
69+
def test_api_version_low(self) -> None:
7070
self.PCAN_API_VERSION_SIM = "1.0"
71-
with self.assertRaises(CanInitializationError):
71+
with self.assertLogs('can.pcan', level='WARNING') as cm:
7272
self.bus = can.Bus(bustype="pcan")
7373

7474
def test_api_version_read_fail(self) -> None:

0 commit comments

Comments
 (0)