From c2f2f5bd6b408937bbc1b7689304a286f4d0eff8 Mon Sep 17 00:00:00 2001 From: Patrik Bachan Date: Sat, 21 Feb 2026 22:12:10 +0100 Subject: [PATCH 1/2] Fix typo in exception name when `JLINKARM_SelectUSB` fails mentioned in #254 --- pylink/jlink.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylink/jlink.py b/pylink/jlink.py index 472f88c..8ef21ba 100644 --- a/pylink/jlink.py +++ b/pylink/jlink.py @@ -731,7 +731,7 @@ def open(self, serial_no=None, ip_addr=None): # preserved here to simplify workflows using one emulator: result = self._dll.JLINKARM_SelectUSB(0) if result != 0: - raise errors.JlinkException('Could not connect to default emulator.') + raise errors.JLinkException('Could not connect to default emulator.') # Acquire the lock for the J-Link being opened only if the serial # number was passed in, otherwise skip it here. Note that the lock From a28a10a57395d66c3488a88dc03bc83bec543cac Mon Sep 17 00:00:00 2001 From: Patrik Bachan Date: Sun, 22 Feb 2026 22:22:45 +0100 Subject: [PATCH 2/2] fix tests: wrong exception type was expected due to recent typo fix, the `JLinkException` is raised, but tests were catching `AttributeError` --- tests/unit/test_jlink.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_jlink.py b/tests/unit/test_jlink.py index 7220d65..53e311a 100644 --- a/tests/unit/test_jlink.py +++ b/tests/unit/test_jlink.py @@ -570,7 +570,7 @@ def test_jlink_open_unspecified(self): Returns: ``None`` """ - with self.assertRaises(AttributeError): + with self.assertRaises(JLinkException): self.jlink.open() def test_jlink_open_unspecified_context_manager(self): @@ -587,7 +587,7 @@ def test_jlink_open_unspecified_context_manager(self): Returns: ``None`` """ - with self.assertRaises(AttributeError): + with self.assertRaises(JLinkException): with jlink.JLink(self.lib) as jl: self.assertTrue(jl.opened()) # Opened in CM. self.dll.JLINKARM_Close.assert_called() # Closed on exit.