Skip to content

Commit 6e807d2

Browse files
author
Elliot Boschwitz
authored
Improved JSON RPC testing exception handling (#380)
1 parent d9f366e commit 6e807d2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/jsonrpc/test_jsonrpcclient.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ def test_receive_invalid_response_exception(self):
207207
self.assertFalse(test_client.response_thread.is_alive())
208208
test_client.shutdown()
209209
self.assertFalse(test_client.request_thread.is_alive())
210+
except Exception as exception:
211+
raise AssertionError("Expected LookupError but caught a different exception: {}"\
212+
.format(exception))
210213
else:
211214
raise AssertionError("LookupError should have been thrown.")
212215
finally:
@@ -231,6 +234,9 @@ def test_response_stream_closed_exception(self):
231234
# Verify the background thread communicated the exception.
232235
self.assertEqual(
233236
str(exception), u'I/O operation on closed file.')
237+
except Exception as exception:
238+
raise AssertionError("Expected ValueError but caught a different exception: {}"\
239+
.format(exception))
234240
else:
235241
raise AssertionError("ValueError should have been thrown.")
236242
finally:
@@ -282,6 +288,9 @@ def test_stream_closed_during_process(self):
282288
str(exception), u'I/O operation on closed file.')
283289
# Verify response thread is dead.
284290
self.assertFalse(test_client.request_thread.is_alive())
291+
except Exception as exception:
292+
raise AssertionError("Expected ValueError but caught a different exception: {}"\
293+
.format(exception))
285294
else:
286295
raise AssertionError("ValueError should have been thrown.")
287296
finally:

0 commit comments

Comments
 (0)