Skip to content

Commit 8f0136a

Browse files
committed
Add test for log output
1 parent f1c5c0b commit 8f0136a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/test_pcan.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,16 @@ def test_bus_creation_fd(self) -> None:
6868

6969
def test_api_version_low(self) -> None:
7070
self.PCAN_API_VERSION_SIM = "1.0"
71-
with self.assertLogs('can.pcan', level='WARNING') as cm:
71+
with self.assertLogs("can.pcan", level="WARNING") as cm:
7272
self.bus = can.Bus(bustype="pcan")
73+
found_version_warning = False
74+
for i in cm.output:
75+
if "version" in i and "pcan" in i:
76+
found_version_warning = True
77+
self.assertTrue(
78+
found_version_warning,
79+
f"No warning was logged for incompatible api version {cm.output}",
80+
)
7381

7482
def test_api_version_read_fail(self) -> None:
7583
self.mock_pcan.GetValue = Mock(return_value=(PCAN_ERROR_ILLOPERATION, None))

0 commit comments

Comments
 (0)