Fix Python tests on MS-Windows

* test/automated/python-tests.el
(python-shell-calculate-command-1): Run python-shell-interpreter
through shell-quote-argument before comparing with what
python-shell-calculate-command returns.
(python-shell-calculate-pythonpath-1)
(python-shell-calculate-pythonpath-2)
(python-shell-calculate-process-environment-2): Use path-separator
instead of a literal ':'.
(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): Run "/env/bin" through
expand-file-name before comparing with exec-path.  (Bug#21375)
This commit is contained in:
Eli Zaretskii 2015-08-29 17:39:47 +03:00
parent 5e5ee391d9
commit 57e1205767

View file

@ -2436,7 +2436,7 @@ Using `python-shell-interpreter' and
(python-shell-interpreter-args "-B"))
(should (string=
(format "%s %s"
python-shell-interpreter
(shell-quote-argument python-shell-interpreter)
python-shell-interpreter-args)
(python-shell-calculate-command)))))
@ -2445,14 +2445,17 @@ Using `python-shell-interpreter' and
(let ((process-environment '("PYTHONPATH=/path0"))
(python-shell-extra-pythonpaths '("/path1" "/path2")))
(should (string= (python-shell-calculate-pythonpath)
"/path1:/path2:/path0"))))
(concat "/path1" path-separator
"/path2" path-separator "/path0")))))
(ert-deftest python-shell-calculate-pythonpath-2 ()
"Test existing paths are moved to front."
(let ((process-environment '("PYTHONPATH=/path0:/path1"))
(let ((process-environment
(list (concat "PYTHONPATH=/path0" path-separator "/path1")))
(python-shell-extra-pythonpaths '("/path1" "/path2")))
(should (string= (python-shell-calculate-pythonpath)
"/path1:/path2:/path0"))))
(concat "/path1" path-separator
"/path2" path-separator "/path0")))))
(ert-deftest python-shell-calculate-process-environment-1 ()
"Test `python-shell-process-environment' modification."
@ -2468,7 +2471,9 @@ Using `python-shell-interpreter' and
(original-pythonpath (setenv "PYTHONPATH" "/path0"))
(python-shell-extra-pythonpaths '("/path1" "/path2"))
(process-environment (python-shell-calculate-process-environment)))
(should (equal (getenv "PYTHONPATH") "/path1:/path2:/path0"))))
(should (equal (getenv "PYTHONPATH")
(concat "/path1" path-separator
"/path2" path-separator "/path0")))))
(ert-deftest python-shell-calculate-process-environment-3 ()
"Test `python-shell-virtualenv-root' modification."
@ -2545,7 +2550,8 @@ Using `python-shell-interpreter' and
(let* ((exec-path '("/path0"))
(python-shell-virtualenv-root "/env")
(new-exec-path (python-shell-calculate-exec-path)))
(should (equal new-exec-path '("/env/bin" "/path0")))))
(should (equal new-exec-path
(list (expand-file-name "/env/bin") "/path0")))))
(ert-deftest python-shell-calculate-exec-path-3 ()
"Test complete `python-shell-virtualenv-root' modification."
@ -2553,7 +2559,9 @@ Using `python-shell-interpreter' and
(python-shell-exec-path '("/path1" "/path2"))
(python-shell-virtualenv-root "/env")
(new-exec-path (python-shell-calculate-exec-path)))
(should (equal new-exec-path '("/env/bin" "/path1" "/path2" "/path0")))))
(should (equal new-exec-path
(list (expand-file-name "/env/bin")
"/path1" "/path2" "/path0")))))
(ert-deftest python-shell-calculate-exec-path-4 ()
"Test complete `python-shell-virtualenv-root' with remote."
@ -2562,7 +2570,9 @@ Using `python-shell-interpreter' and
(python-shell-exec-path '("/path1" "/path2"))
(python-shell-virtualenv-root "/env")
(new-exec-path (python-shell-calculate-exec-path)))
(should (equal new-exec-path '("/env/bin" "/path1" "/path2" "/path0")))))
(should (equal new-exec-path
(list (expand-file-name "/env/bin")
"/path1" "/path2" "/path0")))))
(ert-deftest python-shell-calculate-exec-path-5 ()
"Test no side-effects on `exec-path'."
@ -2590,7 +2600,9 @@ Using `python-shell-interpreter' and
(original-exec-path exec-path)
(python-shell-virtualenv-root "/env"))
(python-shell-with-environment
(should (equal exec-path '("/env/bin" "/path1" "/path2" "/path0")))
(should (equal exec-path
(list (expand-file-name "/env/bin")
"/path1" "/path2" "/path0")))
(should (not (getenv "PYTHONHOME")))
(should (string= (getenv "VIRTUAL_ENV") "/env")))
(should (equal exec-path original-exec-path))))
@ -2605,7 +2617,8 @@ Using `python-shell-interpreter' and
(python-shell-virtualenv-root "/env"))
(python-shell-with-environment
(should (equal (python-shell-calculate-exec-path)
'("/env/bin" "/path1" "/path2" "/remote1" "/remote2")))
(list (expand-file-name "/env/bin")
"/path1" "/path2" "/remote1" "/remote2")))
(let ((process-environment (python-shell-calculate-process-environment)))
(should (not (getenv "PYTHONHOME")))
(should (string= (getenv "VIRTUAL_ENV") "/env"))