[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 9d48979: Fix Python tests depending on system-typ
From: |
Juanma Barranquero |
Subject: |
[Emacs-diffs] emacs-26 9d48979: Fix Python tests depending on system-type |
Date: |
Sun, 16 Jun 2019 20:50:27 -0400 (EDT) |
branch: emacs-26
commit 9d48979ca8000f4d29fdfcdfec63d3ee53024ac4
Author: Juanma Barranquero <address@hidden>
Commit: Juanma Barranquero <address@hidden>
Fix Python tests depending on system-type
* test/lisp/progmodes/python-tests.el (python-virt-bin): New function.
(python-shell-calculate-exec-path-2)
(python-shell-calculate-exec-path-3)
(python-shell-calculate-exec-path-4)
(python-shell-with-environment-1, python-shell-with-environment-2):
Use it.
---
test/lisp/progmodes/python-tests.el | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/test/lisp/progmodes/python-tests.el
b/test/lisp/progmodes/python-tests.el
index 3ce27a6..bea44be 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."
(overlay-end overlay))))
(buffer-substring-no-properties (point-min) (point-max)))))
+(defun python-virt-bin (&optional virt-root)
+ "Return the virtualenv bin dir, starting from VIRT-ROOT.
+If nil, VIRT-ROOT defaults to `python-shell-virtualenv-root'.
+POSIX and Windows systems have different defauls."
+ (expand-file-name
+ (concat
+ (file-name-as-directory (or virt-root
+ python-shell-virtualenv-root))
+ (if (eq system-type 'windows-nt) "Scripts" "bin"))))
+
;;; Tests for your tests, so you can test while you test.
@@ -2664,7 +2674,7 @@ if x:
(python-shell-virtualenv-root "/env")
(new-exec-path (python-shell-calculate-exec-path)))
(should (equal new-exec-path
- (list (expand-file-name "/env/bin") "/path0")))))
+ (list (python-virt-bin) "/path0")))))
(ert-deftest python-shell-calculate-exec-path-3 ()
"Test complete `python-shell-virtualenv-root' modification."
@@ -2673,7 +2683,7 @@ if x:
(python-shell-virtualenv-root "/env")
(new-exec-path (python-shell-calculate-exec-path)))
(should (equal new-exec-path
- (list (expand-file-name "/env/bin")
+ (list (python-virt-bin)
"/path1" "/path2" "/path0")))))
(ert-deftest python-shell-calculate-exec-path-4 ()
@@ -2684,7 +2694,7 @@ if x:
(python-shell-virtualenv-root "/env")
(new-exec-path (python-shell-calculate-exec-path)))
(should (equal new-exec-path
- (list (expand-file-name "/env/bin")
+ (list (python-virt-bin)
"/path1" "/path2" "/path0")))))
(ert-deftest python-shell-calculate-exec-path-5 ()
@@ -2714,7 +2724,7 @@ if x:
(python-shell-virtualenv-root "/env"))
(python-shell-with-environment
(should (equal exec-path
- (list (expand-file-name "/env/bin")
+ (list (python-virt-bin)
"/path1" "/path2" "/path0")))
(should (not (getenv "PYTHONHOME")))
(should (string= (getenv "VIRTUAL_ENV") "/env")))
@@ -2730,7 +2740,7 @@ if x:
(python-shell-virtualenv-root "/env"))
(python-shell-with-environment
(should (equal (python-shell-calculate-exec-path)
- (list (expand-file-name "/env/bin")
+ (list (python-virt-bin)
"/path1" "/path2" "/remote1" "/remote2")))
(let ((process-environment (python-shell-calculate-process-environment)))
(should (not (getenv "PYTHONHOME")))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 9d48979: Fix Python tests depending on system-type,
Juanma Barranquero <=