Skip to content

Commit cd5232e

Browse files
committed
Detect PATH changes in the proper environment.
1 parent 0bcdb51 commit cd5232e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

pythonic.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ process flag."
218218
(defun pythonic-proper-environment-p (process)
219219
"Determine if python environment has been changed since PROCESS was started."
220220
(--if-let (process-get process 'pythonic)
221-
(equal (plist-get it :pythonpath) (pythonic-get-pythonpath))
221+
(and
222+
(equal (plist-get it :pythonpath) (pythonic-get-pythonpath))
223+
(equal (plist-get it :path) (pythonic-get-path)))
222224
(error "Process %s wasn't started with `start-pythonic'"
223225
(process-name process))))
224226

test/pythonic-test.el

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ remote host."
306306
(should (process-query-on-exit-flag
307307
(start-pythonic :process "out" :args '("-V") :query-on-exit t))))
308308

309+
;;; Proper process environment detection.
310+
309311
(ert-deftest test-start-pythonic-path-property ()
310312
"Set `python-shell-exec-path' as `path' process property."
311313
(let* ((home (f-expand "~"))
@@ -383,8 +385,6 @@ Respect remote PYTHONPATH value."
383385
'pythonic)
384386
:environment)))))
385387

386-
;;; Up to date process environment.
387-
388388
(ert-deftest test-pythonic-proper-environment-p-non-pythonic-process ()
389389
"Applying `pythonic-proper-environment-p' to the process
390390
doesn't started with `start-pythonic' will cause error."
@@ -403,6 +403,12 @@ change since process was start."
403403
(python-shell-extra-pythonpaths '("/home/test/modules")))
404404
(should-not (pythonic-proper-environment-p process))))
405405

406+
(ert-deftest test-pythonic-proper-environment-p-change-path ()
407+
"`pythonic-proper-environment-p' is null if PATH was changed."
408+
(let* ((process (start-pythonic :process "out" :args '("-V")))
409+
(python-shell-exec-path '("/home/test/bin")))
410+
(should-not (pythonic-proper-environment-p process))))
411+
406412
;;; Activate/deactivate environment.
407413

408414
(ert-deftest test-pythonic-activate ()

0 commit comments

Comments
 (0)