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

Fix edit magic payload type #1171

Merged
merged 1 commit into from
Nov 27, 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/zmqshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def edit(self, parameter_s="", last_call=None):

# Make sure we send to the client an absolute path, in case the working
# directory of client and kernel don't match
filename = Path(filename).resolve()
filename = str(Path(filename).resolve())

payload = {"source": "edit_magic", "filename": filename, "line_number": lineno}
assert self.shell is not None
Expand Down
3 changes: 3 additions & 0 deletions tests/test_zmq_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ def test_magics(tmp_path):
tmp_file = tmp_path / "test.txt"
tmp_file.write_text("hi", "utf8")
magics.edit(str(tmp_file))
payload = shell.payload_manager.read_payload()[0]
assert payload["filename"] == str(tmp_file)

magics.clear([])
magics.less(str(tmp_file))
if os.name == "posix":
Expand Down
Loading