Skip to content

Commit 0367a7d

Browse files
committed
Replace is_alive mock with monkeypatch
1 parent a92f697 commit 0367a7d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

nbclient/tests/test_client.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,13 @@ def test_kernel_death(self):
505505
output_nb = executor.execute()
506506
km = executor.start_kernel_manager()
507507

508-
with patch.object(km, "is_alive") as alive_mock:
509-
alive_mock.return_value = False
510-
# Will be a RuntimeError or subclass DeadKernelError depending
511-
# on if jupyter_client or nbconvert catches the dead client first
512-
with pytest.raises(RuntimeError):
513-
input_nb, output_nb = executor.execute()
508+
async def is_alive():
509+
return False
510+
km.is_alive = is_alive
511+
# Will be a RuntimeError or subclass DeadKernelError depending
512+
# on if jupyter_client or nbconvert catches the dead client first
513+
with pytest.raises(RuntimeError):
514+
input_nb, output_nb = executor.execute()
514515

515516
def test_allow_errors(self):
516517
"""

0 commit comments

Comments
 (0)