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 87cee189eac..b1cf7e8806a 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'.
140The name of this directory depends on `system-type'."
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
@@ -2704,7 +2714,7 @@ if x:
2704 (python-shell-virtualenv-root "/env") 2714 (python-shell-virtualenv-root "/env")
2705 (new-exec-path (python-shell-calculate-exec-path))) 2715 (new-exec-path (python-shell-calculate-exec-path)))
2706 (should (equal new-exec-path 2716 (should (equal new-exec-path
2707 (list (expand-file-name "/env/bin") "/path0"))))) 2717 (list (python-virt-bin) "/path0")))))
2708 2718
2709(ert-deftest python-shell-calculate-exec-path-3 () 2719(ert-deftest python-shell-calculate-exec-path-3 ()
2710 "Test complete `python-shell-virtualenv-root' modification." 2720 "Test complete `python-shell-virtualenv-root' modification."
@@ -2713,7 +2723,7 @@ if x:
2713 (python-shell-virtualenv-root "/env") 2723 (python-shell-virtualenv-root "/env")
2714 (new-exec-path (python-shell-calculate-exec-path))) 2724 (new-exec-path (python-shell-calculate-exec-path)))
2715 (should (equal new-exec-path 2725 (should (equal new-exec-path
2716 (list (expand-file-name "/env/bin") 2726 (list (python-virt-bin)
2717 "/path1" "/path2" "/path0"))))) 2727 "/path1" "/path2" "/path0")))))
2718 2728
2719(ert-deftest python-shell-calculate-exec-path-4 () 2729(ert-deftest python-shell-calculate-exec-path-4 ()
@@ -2724,7 +2734,7 @@ if x:
2724 (python-shell-virtualenv-root "/env") 2734 (python-shell-virtualenv-root "/env")
2725 (new-exec-path (python-shell-calculate-exec-path))) 2735 (new-exec-path (python-shell-calculate-exec-path)))
2726 (should (equal new-exec-path 2736 (should (equal new-exec-path
2727 (list (expand-file-name "/env/bin") 2737 (list (python-virt-bin)
2728 "/path1" "/path2" "/path0"))))) 2738 "/path1" "/path2" "/path0")))))
2729 2739
2730(ert-deftest python-shell-calculate-exec-path-5 () 2740(ert-deftest python-shell-calculate-exec-path-5 ()
@@ -2754,7 +2764,7 @@ if x:
2754 (python-shell-virtualenv-root "/env")) 2764 (python-shell-virtualenv-root "/env"))
2755 (python-shell-with-environment 2765 (python-shell-with-environment
2756 (should (equal exec-path 2766 (should (equal exec-path
2757 (list (expand-file-name "/env/bin") 2767 (list (python-virt-bin)
2758 "/path1" "/path2" "/path0"))) 2768 "/path1" "/path2" "/path0")))
2759 (should (not (getenv "PYTHONHOME"))) 2769 (should (not (getenv "PYTHONHOME")))
2760 (should (string= (getenv "VIRTUAL_ENV") "/env"))) 2770 (should (string= (getenv "VIRTUAL_ENV") "/env")))
@@ -2770,7 +2780,7 @@ if x:
2770 (python-shell-virtualenv-root "/env")) 2780 (python-shell-virtualenv-root "/env"))
2771 (python-shell-with-environment 2781 (python-shell-with-environment
2772 (should (equal (python-shell-calculate-exec-path) 2782 (should (equal (python-shell-calculate-exec-path)
2773 (list (expand-file-name "/env/bin") 2783 (list (python-virt-bin)
2774 "/path1" "/path2" "/remote1" "/remote2"))) 2784 "/path1" "/path2" "/remote1" "/remote2")))
2775 (let ((process-environment (python-shell-calculate-process-environment))) 2785 (let ((process-environment (python-shell-calculate-process-environment)))
2776 (should (not (getenv "PYTHONHOME"))) 2786 (should (not (getenv "PYTHONHOME")))