Conversation
| yield f | ||
|
|
||
|
|
||
| class DeviceNotFoundException(Exception): |
There was a problem hiding this comment.
would do class DeviceNotFound(Exception)
| self._path = None | ||
| self._device_index = None | ||
| self.connected = False | ||
| raise DeviceNotFoundException("No device matching the given requirements was found.") |
There was a problem hiding this comment.
"%s is not connected" % self would let the user know exactly which device isn't connected
| # rather than a library error. If that isn't the case, at a minimum the underlying | ||
| # error info will be printed for debugging. | ||
| raise Exception("%s is no longer connected" % self) from driver_error | ||
| raise DeviceNotFoundException("%s is no longer connected" % self) from driver_error |
There was a problem hiding this comment.
s/DeviceNotFoundException/DeviceNotFound/
|
|
||
| d = ev3.Device('this-does-not-exist') | ||
| self.assertFalse(d.connected) | ||
| with self.assertRaises(ev3.DeviceNotFoundException): |
There was a problem hiding this comment.
other than that it looks good to me
There was a problem hiding this comment.
😟 Why didn't our tests catch this? That's... quite worrying.
|
|
|
@dwalton76 sorry, I'm quite busy right now so might not be able to take another look at these PRs for another few weeks. If I do get some time I'll report back. |
|
I got a chance to test this on my EV3. I instantiated a motor with motors connected and without and it operated as expected. |
Fixes #372
I haven't tested this on-device yet.