Skip to content

Commit

Permalink
Fix edit magic payload type (#1171)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Nov 27, 2023
1 parent a09892e commit f9c517e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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

0 comments on commit f9c517e

Please sign in to comment.