Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check existence of connection_file before writing #1127

Merged
merged 6 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ipykernel/eventloops.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ async def close_loop():
close_loop()

elif not loop.is_closed():
loop.run_until_complete(close_loop) # type:ignore[call-overload]
loop.run_until_complete(close_loop) # type:ignore
loop.close()


Expand Down
3 changes: 3 additions & 0 deletions ipykernel/inprocess/tests/test_kernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import unittest

from flaky import flaky

from ipykernel.inprocess.manager import InProcessKernelManager

# -----------------------------------------------------------------------------
Expand All @@ -18,6 +20,7 @@ def tearDown(self):
if self.km.has_kernel:
self.km.shutdown_kernel()

@flaky
def test_interface(self):
"""Does the in-process kernel manager implement the basic KM interface?"""
km = self.km
Expand Down
3 changes: 3 additions & 0 deletions ipykernel/kernelapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ def _bind_socket(self, s, port):
def write_connection_file(self):
"""write connection info to JSON file"""
cf = self.abs_connection_file
if os.path.exists(cf):
blink1073 marked this conversation as resolved.
Show resolved Hide resolved
self.log.debug("Connection file %s already exists", cf)
return
self.log.debug("Writing connection file: %s", cf)
write_connection_file(
cf,
Expand Down
4 changes: 2 additions & 2 deletions ipykernel/tests/test_debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_set_breakpoints(kernel_with_debug):
assert reply["body"]["breakpoints"][0]["source"]["path"] == source

r = wait_for_debug_request(kernel_with_debug, "debugInfo")
assert source in map(lambda b: b["source"], r["body"]["breakpoints"]) # type:ignore # noqa
assert source in map(lambda b: b["source"], r["body"]["breakpoints"]) # noqa

r = wait_for_debug_request(kernel_with_debug, "configurationDone")
assert r["success"]
Expand Down Expand Up @@ -208,7 +208,7 @@ def test_rich_inspect_not_at_breakpoint(kernel_with_debug):
get_reply(kernel_with_debug, msg_id)

r = wait_for_debug_request(kernel_with_debug, "inspectVariables")
assert var_name in list(map(lambda v: v["name"], r["body"]["variables"])) # type:ignore # noqa
assert var_name in list(map(lambda v: v["name"], r["body"]["variables"])) # noqa

reply = wait_for_debug_request(
kernel_with_debug,
Expand Down