1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-09 21:20:45 -08:00

Fix Python PDB tracking for remote inferior Python

* lisp/progmodes/python.el (python-shell-local-prefix): New
constant.
(python-shell--convert-file-name-to-send): New function to
add/remove prefix.
(python-shell-send-string, python-shell-send-file): Changed to
use 'python-shell--convert-file-name-to-send'.
(python-pdbtrack-set-tracked-buffer): Changed to add/remove
prefix.
* test/lisp/progmodes/python-tests.el
(python-shell--convert-file-name-to-send-1): New test.
(Bug#79036)
This commit is contained in:
kobarity 2025-08-06 23:08:49 +09:00 committed by Eli Zaretskii
parent 68aaeb3519
commit 3d8fbb0716
2 changed files with 66 additions and 8 deletions

View file

@ -4602,6 +4602,32 @@ and `python-shell-interpreter-args' in the new shell buffer."
"^\\(o\\.t \\|\\)")))
(ignore-errors (delete-file startup-file))))))
(ert-deftest python-shell--convert-file-name-to-send-1 ()
"Test parameters consist of a list of the following three elements.
1. The variable `default-directory' of the process.
2. FILE-NAME argument.
3. The expected return value."
(python-tests-with-temp-buffer-with-shell
""
(let* ((path "/tmp/tmp.py")
(local-path (concat python-shell-local-prefix path))
(remote1-path (concat "/ssh:remote1:" path))
(remote2-path (concat "/ssh:remote2:" path))
(process (python-shell-get-process)))
(dolist
(test (list (list "/tmp" nil nil)
(list "/tmp" path path)
(list "/tmp" local-path path)
(list "/ssh:remote1:/tmp" path local-path)
(list "/ssh:remote1:/tmp" local-path local-path)
(list "/ssh:remote1:/tmp" remote1-path path)
(list "/ssh:remote1:/tmp" remote2-path remote2-path)))
(with-current-buffer (process-buffer process)
(setq default-directory (nth 0 test)))
(should (string= (python-shell--convert-file-name-to-send
process (nth 1 test))
(nth 2 test)))))))
(ert-deftest python-shell-buffer-substring-1 ()
"Selecting a substring of the whole buffer must match its contents."
(python-tests-with-temp-buffer