Skip to content

Commit

Permalink
Use supported_features=['debugger'] in kernel info reply
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthomas23 committed Nov 18, 2024
1 parent 8c4901d commit 1cf373b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ipykernel/kernelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,12 @@ def kernel_info(self):
}
if self._supports_kernel_subshells:
info["supported_features"] = ["kernel subshells"]

from .debugger import _is_debugpy_available

if _is_debugpy_available:
info["supported_features"].append("debugger")

return info

async def kernel_info_request(self, socket, ident, parent):
Expand Down
11 changes: 11 additions & 0 deletions tests/test_debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ def test_debug_initialize(kernel):
assert reply == {}


def test_supported_features(kernel_with_debug):
kernel_with_debug.kernel_info()
reply = kernel_with_debug.get_shell_msg(timeout=TIMEOUT)
supported_features = reply["content"]["supported_features"]

if debugpy:
assert "debugger" in supported_features
else:
assert "debugger" not in supported_features


def test_attach_debug(kernel_with_debug):
reply = wait_for_debug_request(
kernel_with_debug, "evaluate", {"expression": "'a' + 'b'", "context": "repl"}
Expand Down

0 comments on commit 1cf373b

Please sign in to comment.