Skip to content

Commit

Permalink
fix(tests): delete uneeded tests
Browse files Browse the repository at this point in the history
  • Loading branch information
devstein committed Nov 13, 2024
1 parent 9b36630 commit 763a930
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions sparkmagic/sparkmagic/tests/test_sparkkernelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,18 @@ def test_execute_valid_code():
execute_cell_mock.assert_called_once_with(code, False, True, None, False)
assert execute_cell_mock.return_value is ret
assert kernel._fatal_error is None

assert ipython_display.send_error.call_count == 0


def test_execute_throws_if_fatal_error_happened():
# Verify that if a fatal error already happened, we don't run the code and show the fatal error instead.
fatal_error = "Error."
kernel._fatal_error = fatal_error
kernel.do_execute(code, False)

ret = kernel.do_execute(code, False)

assert execute_cell_mock.return_value is ret
assert kernel._fatal_error == fatal_error
execute_cell_mock.assert_called_once_with("None", True)
# assert kernel._complete_cell ran after the error
execute_cell_mock.assert_called_once_with("None", False, True, None, False)
assert ipython_display.send_error.call_count == 1


Expand All @@ -71,9 +70,9 @@ def test_execute_alerts_user_if_an_unexpected_error_happens():
kernel._fatal_error = "Something bad happened before"
kernel._repeat_fatal_error = MagicMock(side_effect=ValueError)

ret = kernel.do_execute(code, False)
assert execute_cell_mock.return_value is ret
execute_cell_mock.assert_called_once_with("None", True)
kernel.do_execute(code, False)
# assert kernel._complete_cell ran after the error
execute_cell_mock.assert_called_once_with("None", False, True, None, False)
assert ipython_display.send_error.call_count == 1


Expand All @@ -87,12 +86,11 @@ def test_execute_throws_if_fatal_error_happens_for_execution():

execute_cell_mock.return_value = reply_content

ret = kernel._execute_cell(
code, False, shutdown_if_error=True, log_if_error=fatal_error
)
assert execute_cell_mock.return_value is ret
kernel._execute_cell(code, False, shutdown_if_error=True, log_if_error=fatal_error)

assert kernel._fatal_error == message
execute_cell_mock.assert_called_once_with("None", True)
# assert kernel._complete_cell ran after the error
execute_cell_mock.assert_called_once_with("None", False, True, None, False)
assert ipython_display.send_error.call_count == 1


Expand Down

0 comments on commit 763a930

Please sign in to comment.