Skip to content

Commit

Permalink
fix handling of kernel activity
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Nov 22, 2021
1 parent 8bf336b commit c39c60b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jupyter_server/services/kernels/kernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def record_activity(msg_list):
def stop_watching_activity(self, kernel_id):
"""Stop watching IOPub messages on a kernel for activity."""
kernel = self._kernels[kernel_id]
if kernel._activity_stream:
if getattr(kernel, '_activity_stream', None):
kernel._activity_stream.close()
kernel._activity_stream = None

Expand Down
4 changes: 3 additions & 1 deletion jupyter_server/tests/services/sessions/test_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import os
import shutil
import time

Expand Down Expand Up @@ -246,7 +247,8 @@ async def test_create_bad_pending(
resp = await session_client.list()
session = j(resp)[0]
assert session["kernel"]["execution_state"] == "dead"
assert "non_existent_path" in session["kernel"]["reason"]
if os.name != "nt":
assert "non_existent_path" in session["kernel"]["reason"]

# Need to find a better solution to this.
await session_client.cleanup()
Expand Down

0 comments on commit c39c60b

Please sign in to comment.