aboutsummaryrefslogtreecommitdiffstats
path: root/test/automated/python-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/automated/python-tests.el')
-rw-r--r--test/automated/python-tests.el44
1 files changed, 36 insertions, 8 deletions
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index 2ed07464df6..d490f7f9df5 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -27,6 +27,7 @@
27;; Dependencies for testing: 27;; Dependencies for testing:
28(require 'electric) 28(require 'electric)
29(require 'hideshow) 29(require 'hideshow)
30(require 'tramp-sh)
30 31
31 32
32(defmacro python-tests-with-temp-buffer (contents &rest body) 33(defmacro python-tests-with-temp-buffer (contents &rest body)
@@ -2463,17 +2464,12 @@ Using `python-shell-interpreter' and
2463 2464
2464(ert-deftest python-shell-calculate-process-environment-3 () 2465(ert-deftest python-shell-calculate-process-environment-3 ()
2465 "Test `python-shell-virtualenv-root' modification." 2466 "Test `python-shell-virtualenv-root' modification."
2466 (let* ((original-path (or (getenv "PATH") "")) 2467 (let* ((python-shell-virtualenv-root
2467 (python-shell-virtualenv-root
2468 (directory-file-name user-emacs-directory)) 2468 (directory-file-name user-emacs-directory))
2469 (process-environment 2469 (process-environment
2470 (python-shell-calculate-process-environment))) 2470 (python-shell-calculate-process-environment)))
2471 (should (not (getenv "PYTHONHOME"))) 2471 (should (not (getenv "PYTHONHOME")))
2472 (should (string= (getenv "VIRTUAL_ENV") python-shell-virtualenv-root)) 2472 (should (string= (getenv "VIRTUAL_ENV") python-shell-virtualenv-root))))
2473 (should (equal (getenv "PATH")
2474 (format "%s/bin%s%s"
2475 python-shell-virtualenv-root
2476 path-separator original-path)))))
2477 2473
2478(ert-deftest python-shell-calculate-process-environment-4 () 2474(ert-deftest python-shell-calculate-process-environment-4 ()
2479 "Test `python-shell-unbuffered' modification." 2475 "Test `python-shell-unbuffered' modification."
@@ -2503,7 +2499,7 @@ Using `python-shell-interpreter' and
2503 original-exec-path))))) 2499 original-exec-path)))))
2504 2500
2505(ert-deftest python-shell-calculate-exec-path-2 () 2501(ert-deftest python-shell-calculate-exec-path-2 ()
2506 "Test `python-shell-exec-path' modification." 2502 "Test `python-shell-virtualenv-root' modification."
2507 (let* ((original-exec-path exec-path) 2503 (let* ((original-exec-path exec-path)
2508 (python-shell-virtualenv-root 2504 (python-shell-virtualenv-root
2509 (directory-file-name (expand-file-name user-emacs-directory))) 2505 (directory-file-name (expand-file-name user-emacs-directory)))
@@ -2514,6 +2510,38 @@ Using `python-shell-interpreter' and
2514 (format "%s/bin" python-shell-virtualenv-root) 2510 (format "%s/bin" python-shell-virtualenv-root)
2515 original-exec-path)))))) 2511 original-exec-path))))))
2516 2512
2513(ert-deftest python-shell-with-environment-1 ()
2514 "Test with local `default-directory'."
2515 (let* ((original-exec-path exec-path)
2516 (python-shell-virtualenv-root
2517 (directory-file-name (expand-file-name user-emacs-directory))))
2518 (python-shell-with-environment
2519 (should (equal
2520 exec-path
2521 (append (cons
2522 (format "%s/bin" python-shell-virtualenv-root)
2523 original-exec-path))))
2524 (should (not (getenv "PYTHONHOME")))
2525 (should (string= (getenv "VIRTUAL_ENV") python-shell-virtualenv-root)))))
2526
2527(ert-deftest python-shell-with-environment-2 ()
2528 "Test with remote `default-directory'."
2529 (let* ((default-directory "/ssh::/example/dir/")
2530 (original-exec-path tramp-remote-path)
2531 (original-process-environment tramp-remote-process-environment)
2532 (python-shell-virtualenv-root
2533 (directory-file-name (expand-file-name user-emacs-directory))))
2534 (python-shell-with-environment
2535 (should (equal
2536 tramp-remote-path
2537 (append (cons
2538 (format "%s/bin" python-shell-virtualenv-root)
2539 original-exec-path))))
2540 (let ((process-environment tramp-remote-process-environment))
2541 (should (not (getenv "PYTHONHOME")))
2542 (should (string= (getenv "VIRTUAL_ENV")
2543 python-shell-virtualenv-root))))))
2544
2517(ert-deftest python-shell-make-comint-1 () 2545(ert-deftest python-shell-make-comint-1 ()
2518 "Check comint creation for global shell buffer." 2546 "Check comint creation for global shell buffer."
2519 (skip-unless (executable-find python-tests-shell-interpreter)) 2547 (skip-unless (executable-find python-tests-shell-interpreter))