Skip to content

Commit 1693f94

Browse files
committed
Add pye-test-make-environment-with-non-existing-command
1 parent 2500670 commit 1693f94

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

python-environment.el

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@
6363
If VIRTUALENV (list of string) is specified, it is used instead of
6464
`python-environment-virtualenv'."
6565
(let ((path (convert-standard-filename (expand-file-name
66-
(or root python-environment-root)))))
66+
(or root python-environment-root))))
67+
(virtualenv (or virtualenv python-environment-virtualenv)))
68+
(unless (executable-find (car virtualenv))
69+
(error "Program named %S does not exist." (car virtualenv)))
6770
(python-environment--deferred-process
6871
(format "Making virtualenv at %s" path)
69-
(append (or virtualenv python-environment-virtualenv)
70-
(list path)))))
72+
(append virtualenv (list path)))))
7173

7274
(defun python-environment-exists-p (&optional root)
7375
"Return non-`nil' if virtualenv at ROOT exists."

test-python-environment.el

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ variable can be given as ENVIRONMENT (see `pye-with-mixed-environment')."
8383
(error "Subprocess terminated with code %S.\nOutput:\n%s"
8484
code (buffer-string)))))))))
8585

86+
(pye-deftest pye-test-make-environment-with-non-existing-command ()
87+
(should-error (python-environment-make nil '("non-existing-command"))))
88+
8689
(pye-deftest pye-test-make-environment ()
8790
(deferred:sync! (python-environment-make)))
8891

0 commit comments

Comments
 (0)