aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/progmodes/python-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
-rw-r--r--test/lisp/progmodes/python-tests.el20
1 files changed, 15 insertions, 5 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 3ce27a687da..bea44bede9e 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -134,6 +134,16 @@ default to `point-min' and `point-max' respectively."
134 (overlay-end overlay)))) 134 (overlay-end overlay))))
135 (buffer-substring-no-properties (point-min) (point-max))))) 135 (buffer-substring-no-properties (point-min) (point-max)))))
136 136
137(defun python-virt-bin (&optional virt-root)
138 "Return the virtualenv bin dir, starting from VIRT-ROOT.
139If nil, VIRT-ROOT defaults to `python-shell-virtualenv-root'.
140POSIX and Windows systems have different defauls."
141 (expand-file-name
142 (concat
143 (file-name-as-directory (or virt-root
144 python-shell-virtualenv-root))
145 (if (eq system-type 'windows-nt) "Scripts" "bin"))))
146
137 147
138;;; Tests for your tests, so you can test while you test. 148;;; Tests for your tests, so you can test while you test.
139 149
@@ -2664,7 +2674,7 @@ if x:
2664 (python-shell-virtualenv-root "/env") 2674 (python-shell-virtualenv-root "/env")
2665 (new-exec-path (python-shell-calculate-exec-path))) 2675 (new-exec-path (python-shell-calculate-exec-path)))
2666 (should (equal new-exec-path 2676 (should (equal new-exec-path
2667 (list (expand-file-name "/env/bin") "/path0"))))) 2677 (list (python-virt-bin) "/path0")))))
2668 2678
2669(ert-deftest python-shell-calculate-exec-path-3 () 2679(ert-deftest python-shell-calculate-exec-path-3 ()
2670 "Test complete `python-shell-virtualenv-root' modification." 2680 "Test complete `python-shell-virtualenv-root' modification."
@@ -2673,7 +2683,7 @@ if x:
2673 (python-shell-virtualenv-root "/env") 2683 (python-shell-virtualenv-root "/env")
2674 (new-exec-path (python-shell-calculate-exec-path))) 2684 (new-exec-path (python-shell-calculate-exec-path)))
2675 (should (equal new-exec-path 2685 (should (equal new-exec-path
2676 (list (expand-file-name "/env/bin") 2686 (list (python-virt-bin)
2677 "/path1" "/path2" "/path0"))))) 2687 "/path1" "/path2" "/path0")))))
2678 2688
2679(ert-deftest python-shell-calculate-exec-path-4 () 2689(ert-deftest python-shell-calculate-exec-path-4 ()
@@ -2684,7 +2694,7 @@ if x:
2684 (python-shell-virtualenv-root "/env") 2694 (python-shell-virtualenv-root "/env")
2685 (new-exec-path (python-shell-calculate-exec-path))) 2695 (new-exec-path (python-shell-calculate-exec-path)))
2686 (should (equal new-exec-path 2696 (should (equal new-exec-path
2687 (list (expand-file-name "/env/bin") 2697 (list (python-virt-bin)
2688 "/path1" "/path2" "/path0"))))) 2698 "/path1" "/path2" "/path0")))))
2689 2699
2690(ert-deftest python-shell-calculate-exec-path-5 () 2700(ert-deftest python-shell-calculate-exec-path-5 ()
@@ -2714,7 +2724,7 @@ if x:
2714 (python-shell-virtualenv-root "/env")) 2724 (python-shell-virtualenv-root "/env"))
2715 (python-shell-with-environment 2725 (python-shell-with-environment
2716 (should (equal exec-path 2726 (should (equal exec-path
2717 (list (expand-file-name "/env/bin") 2727 (list (python-virt-bin)
2718 "/path1" "/path2" "/path0"))) 2728 "/path1" "/path2" "/path0")))
2719 (should (not (getenv "PYTHONHOME"))) 2729 (should (not (getenv "PYTHONHOME")))
2720 (should (string= (getenv "VIRTUAL_ENV") "/env"))) 2730 (should (string= (getenv "VIRTUAL_ENV") "/env")))
@@ -2730,7 +2740,7 @@ if x:
2730 (python-shell-virtualenv-root "/env")) 2740 (python-shell-virtualenv-root "/env"))
2731 (python-shell-with-environment 2741 (python-shell-with-environment
2732 (should (equal (python-shell-calculate-exec-path) 2742 (should (equal (python-shell-calculate-exec-path)
2733 (list (expand-file-name "/env/bin") 2743 (list (python-virt-bin)
2734 "/path1" "/path2" "/remote1" "/remote2"))) 2744 "/path1" "/path2" "/remote1" "/remote2")))
2735 (let ((process-environment (python-shell-calculate-process-environment))) 2745 (let ((process-environment (python-shell-calculate-process-environment)))
2736 (should (not (getenv "PYTHONHOME"))) 2746 (should (not (getenv "PYTHONHOME")))