-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure the rpc virtualenv is created from the system environment (#1699)
This is necessary for venv to create a proper virtualenv
- Loading branch information
Showing
6 changed files
with
121 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
;;; -*-coding: utf-8-*- | ||
|
||
(unless elpy-test-dont-use-virtualenv | ||
(ert-deftest elpy-rpc-reinstall-virtualenv-should-reinstall () | ||
(elpy-testcase () | ||
(let* ((elpy-rpc-virtualenv-path 'default) | ||
(rpc-venv-path (elpy-rpc-get-or-create-virtualenv))) | ||
(mletf* ((messages "") | ||
(y-or-n-p (question) | ||
(setq messages (concat messages question)) | ||
t)) | ||
(with-temp-file (concat (file-name-as-directory rpc-venv-path) | ||
"additional-file") | ||
(insert "nothing here")) | ||
(elpy-rpc-reinstall-virtualenv) | ||
(should-not (file-exists-p (concat | ||
(file-name-as-directory rpc-venv-path) | ||
"additional-file"))) | ||
(should (string= messages "Automatically install the RPC dependencies from PyPI (needed for completion, autoformatting and documentation) ? "))))))) | ||
|
||
(unless elpy-test-dont-use-virtualenv | ||
(ert-deftest elpy-rpc-reinstall-virtualenv-should-reinstall-with-global-venv () | ||
(elpy-testcase () | ||
(let* ((elpy-rpc-virtualenv-path 'system) | ||
(rpc-venv-path (elpy-rpc-get-or-create-virtualenv))) | ||
(should-error (elpy-rpc-reinstall-virtualenv)))))) | ||
|
||
(unless elpy-test-dont-use-virtualenv | ||
(ert-deftest elpy-rpc-reinstall-virtualenv-should-reinstall-with-custom-venv () | ||
(elpy-testcase () | ||
(let* ((elpy-rpc-virtualenv-path (concat | ||
(file-name-as-directory | ||
(pyvenv-workon-home)) | ||
"elpy-test-venv")) | ||
(rpc-venv-path (elpy-rpc-get-or-create-virtualenv))) | ||
(mletf* ((messages "") | ||
(y-or-n-p (question) | ||
(setq messages (concat messages question)) | ||
t)) | ||
(with-temp-file (concat (file-name-as-directory rpc-venv-path) | ||
"additional-file") | ||
(insert "nothing here")) | ||
(elpy-rpc-reinstall-virtualenv) | ||
(should-not (file-exists-p (concat | ||
(file-name-as-directory rpc-venv-path) | ||
"additional-file"))) | ||
(should (= 0 (string-match "Are you sure you want to reinstall the virtualenv in '[^']*' (every manual modifications will be lost) \\? `elpy-rpc-virtualenv-path' was set to '[^']*', but this virtualenv does not exist, create it \\? Automatically install the RPC dependencies from PyPI (needed for completion, autoformatting and documentation) \\? " messages)))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters