diff options
| author | Eli Zaretskii | 2015-08-29 17:39:47 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-08-29 17:39:47 +0300 |
| commit | 57e1205767c012d4fcea87d99db987bc7c0d5585 (patch) | |
| tree | 8864d6a167aa7b975914f4e08e10ffcc29fe2f4e /test | |
| parent | 5e5ee391d958980148227083120f176754e0edca (diff) | |
| download | emacs-57e1205767c012d4fcea87d99db987bc7c0d5585.tar.gz emacs-57e1205767c012d4fcea87d99db987bc7c0d5585.zip | |
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)
Diffstat (limited to 'test')
| -rw-r--r-- | test/automated/python-tests.el | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el index 30b1b480a25..219f99eed62 100644 --- a/test/automated/python-tests.el +++ b/test/automated/python-tests.el | |||
| @@ -2436,7 +2436,7 @@ Using `python-shell-interpreter' and | |||
| 2436 | (python-shell-interpreter-args "-B")) | 2436 | (python-shell-interpreter-args "-B")) |
| 2437 | (should (string= | 2437 | (should (string= |
| 2438 | (format "%s %s" | 2438 | (format "%s %s" |
| 2439 | python-shell-interpreter | 2439 | (shell-quote-argument python-shell-interpreter) |
| 2440 | python-shell-interpreter-args) | 2440 | python-shell-interpreter-args) |
| 2441 | (python-shell-calculate-command))))) | 2441 | (python-shell-calculate-command))))) |
| 2442 | 2442 | ||
| @@ -2445,14 +2445,17 @@ Using `python-shell-interpreter' and | |||
| 2445 | (let ((process-environment '("PYTHONPATH=/path0")) | 2445 | (let ((process-environment '("PYTHONPATH=/path0")) |
| 2446 | (python-shell-extra-pythonpaths '("/path1" "/path2"))) | 2446 | (python-shell-extra-pythonpaths '("/path1" "/path2"))) |
| 2447 | (should (string= (python-shell-calculate-pythonpath) | 2447 | (should (string= (python-shell-calculate-pythonpath) |
| 2448 | "/path1:/path2:/path0")))) | 2448 | (concat "/path1" path-separator |
| 2449 | "/path2" path-separator "/path0"))))) | ||
| 2449 | 2450 | ||
| 2450 | (ert-deftest python-shell-calculate-pythonpath-2 () | 2451 | (ert-deftest python-shell-calculate-pythonpath-2 () |
| 2451 | "Test existing paths are moved to front." | 2452 | "Test existing paths are moved to front." |
| 2452 | (let ((process-environment '("PYTHONPATH=/path0:/path1")) | 2453 | (let ((process-environment |
| 2454 | (list (concat "PYTHONPATH=/path0" path-separator "/path1"))) | ||
| 2453 | (python-shell-extra-pythonpaths '("/path1" "/path2"))) | 2455 | (python-shell-extra-pythonpaths '("/path1" "/path2"))) |
| 2454 | (should (string= (python-shell-calculate-pythonpath) | 2456 | (should (string= (python-shell-calculate-pythonpath) |
| 2455 | "/path1:/path2:/path0")))) | 2457 | (concat "/path1" path-separator |
| 2458 | "/path2" path-separator "/path0"))))) | ||
| 2456 | 2459 | ||
| 2457 | (ert-deftest python-shell-calculate-process-environment-1 () | 2460 | (ert-deftest python-shell-calculate-process-environment-1 () |
| 2458 | "Test `python-shell-process-environment' modification." | 2461 | "Test `python-shell-process-environment' modification." |
| @@ -2468,7 +2471,9 @@ Using `python-shell-interpreter' and | |||
| 2468 | (original-pythonpath (setenv "PYTHONPATH" "/path0")) | 2471 | (original-pythonpath (setenv "PYTHONPATH" "/path0")) |
| 2469 | (python-shell-extra-pythonpaths '("/path1" "/path2")) | 2472 | (python-shell-extra-pythonpaths '("/path1" "/path2")) |
| 2470 | (process-environment (python-shell-calculate-process-environment))) | 2473 | (process-environment (python-shell-calculate-process-environment))) |
| 2471 | (should (equal (getenv "PYTHONPATH") "/path1:/path2:/path0")))) | 2474 | (should (equal (getenv "PYTHONPATH") |
| 2475 | (concat "/path1" path-separator | ||
| 2476 | "/path2" path-separator "/path0"))))) | ||
| 2472 | 2477 | ||
| 2473 | (ert-deftest python-shell-calculate-process-environment-3 () | 2478 | (ert-deftest python-shell-calculate-process-environment-3 () |
| 2474 | "Test `python-shell-virtualenv-root' modification." | 2479 | "Test `python-shell-virtualenv-root' modification." |
| @@ -2545,7 +2550,8 @@ Using `python-shell-interpreter' and | |||
| 2545 | (let* ((exec-path '("/path0")) | 2550 | (let* ((exec-path '("/path0")) |
| 2546 | (python-shell-virtualenv-root "/env") | 2551 | (python-shell-virtualenv-root "/env") |
| 2547 | (new-exec-path (python-shell-calculate-exec-path))) | 2552 | (new-exec-path (python-shell-calculate-exec-path))) |
| 2548 | (should (equal new-exec-path '("/env/bin" "/path0"))))) | 2553 | (should (equal new-exec-path |
| 2554 | (list (expand-file-name "/env/bin") "/path0"))))) | ||
| 2549 | 2555 | ||
| 2550 | (ert-deftest python-shell-calculate-exec-path-3 () | 2556 | (ert-deftest python-shell-calculate-exec-path-3 () |
| 2551 | "Test complete `python-shell-virtualenv-root' modification." | 2557 | "Test complete `python-shell-virtualenv-root' modification." |
| @@ -2553,7 +2559,9 @@ Using `python-shell-interpreter' and | |||
| 2553 | (python-shell-exec-path '("/path1" "/path2")) | 2559 | (python-shell-exec-path '("/path1" "/path2")) |
| 2554 | (python-shell-virtualenv-root "/env") | 2560 | (python-shell-virtualenv-root "/env") |
| 2555 | (new-exec-path (python-shell-calculate-exec-path))) | 2561 | (new-exec-path (python-shell-calculate-exec-path))) |
| 2556 | (should (equal new-exec-path '("/env/bin" "/path1" "/path2" "/path0"))))) | 2562 | (should (equal new-exec-path |
| 2563 | (list (expand-file-name "/env/bin") | ||
| 2564 | "/path1" "/path2" "/path0"))))) | ||
| 2557 | 2565 | ||
| 2558 | (ert-deftest python-shell-calculate-exec-path-4 () | 2566 | (ert-deftest python-shell-calculate-exec-path-4 () |
| 2559 | "Test complete `python-shell-virtualenv-root' with remote." | 2567 | "Test complete `python-shell-virtualenv-root' with remote." |
| @@ -2562,7 +2570,9 @@ Using `python-shell-interpreter' and | |||
| 2562 | (python-shell-exec-path '("/path1" "/path2")) | 2570 | (python-shell-exec-path '("/path1" "/path2")) |
| 2563 | (python-shell-virtualenv-root "/env") | 2571 | (python-shell-virtualenv-root "/env") |
| 2564 | (new-exec-path (python-shell-calculate-exec-path))) | 2572 | (new-exec-path (python-shell-calculate-exec-path))) |
| 2565 | (should (equal new-exec-path '("/env/bin" "/path1" "/path2" "/path0"))))) | 2573 | (should (equal new-exec-path |
| 2574 | (list (expand-file-name "/env/bin") | ||
| 2575 | "/path1" "/path2" "/path0"))))) | ||
| 2566 | 2576 | ||
| 2567 | (ert-deftest python-shell-calculate-exec-path-5 () | 2577 | (ert-deftest python-shell-calculate-exec-path-5 () |
| 2568 | "Test no side-effects on `exec-path'." | 2578 | "Test no side-effects on `exec-path'." |
| @@ -2590,7 +2600,9 @@ Using `python-shell-interpreter' and | |||
| 2590 | (original-exec-path exec-path) | 2600 | (original-exec-path exec-path) |
| 2591 | (python-shell-virtualenv-root "/env")) | 2601 | (python-shell-virtualenv-root "/env")) |
| 2592 | (python-shell-with-environment | 2602 | (python-shell-with-environment |
| 2593 | (should (equal exec-path '("/env/bin" "/path1" "/path2" "/path0"))) | 2603 | (should (equal exec-path |
| 2604 | (list (expand-file-name "/env/bin") | ||
| 2605 | "/path1" "/path2" "/path0"))) | ||
| 2594 | (should (not (getenv "PYTHONHOME"))) | 2606 | (should (not (getenv "PYTHONHOME"))) |
| 2595 | (should (string= (getenv "VIRTUAL_ENV") "/env"))) | 2607 | (should (string= (getenv "VIRTUAL_ENV") "/env"))) |
| 2596 | (should (equal exec-path original-exec-path)))) | 2608 | (should (equal exec-path original-exec-path)))) |
| @@ -2605,7 +2617,8 @@ Using `python-shell-interpreter' and | |||
| 2605 | (python-shell-virtualenv-root "/env")) | 2617 | (python-shell-virtualenv-root "/env")) |
| 2606 | (python-shell-with-environment | 2618 | (python-shell-with-environment |
| 2607 | (should (equal (python-shell-calculate-exec-path) | 2619 | (should (equal (python-shell-calculate-exec-path) |
| 2608 | '("/env/bin" "/path1" "/path2" "/remote1" "/remote2"))) | 2620 | (list (expand-file-name "/env/bin") |
| 2621 | "/path1" "/path2" "/remote1" "/remote2"))) | ||
| 2609 | (let ((process-environment (python-shell-calculate-process-environment))) | 2622 | (let ((process-environment (python-shell-calculate-process-environment))) |
| 2610 | (should (not (getenv "PYTHONHOME"))) | 2623 | (should (not (getenv "PYTHONHOME"))) |
| 2611 | (should (string= (getenv "VIRTUAL_ENV") "/env")) | 2624 | (should (string= (getenv "VIRTUAL_ENV") "/env")) |