YouCompleteMe/python/ycm/tests
zzbot 712c417529 Auto merge of #2787 - micbou:improve-path-to-python-interpreter, r=puremourning
[READY] Improve path to python interpreter error handling

YCM returns the cryptic error `YouCompleteMe unavailable: [Errno 2] No such file or directory` when the Python interpreter path used to start the server doesn't exist. See issues https://github.com/Valloric/YouCompleteMe/issues/2773 and https://github.com/Valloric/YouCompleteMe/issues/2775.

This PR improves that by using the `FindExecutable` and `GetExecutable` functions from ycmd to check if the Python interpreter path exists (and is an executable) and by returning a much more helpful message if it doesn't. We use `FindExecutable` instead of `GetExecutable` on the `g:ycm_server_python_interpreter` option so that the user can specify a Python path with just the executable name (e.g. `python`, `python2`, `python3`).

This also fixes a Python traceback in Vim that occurs when, after successfully starting the server, the `g:ycm_server_python_interpreter` option is set to an invalid path and the server is restarted with `:YcmRestartServer`. Steps to reproduce are:
 - start Vim with a working YCM;
 - type `:let g:ycm_server_python_interpreter = '/invalid/python/path'`;
 - type `:YcmRestartServer`.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2787)
<!-- Reviewable:end -->
2017-09-21 14:07:27 -07:00
..
client Rewrite completion system 2017-06-21 02:32:57 +02:00
testdata Tests for checking that extra_conf_data sended to server from :DebugInfo and :YcmCompleter commands. 2017-03-12 19:03:07 +03:00
__init__.py Improve path to python interpreter error handling 2017-09-21 21:17:32 +02:00
base_test.py Use codepoint offsets in identifier functions 2017-06-18 20:41:30 +02:00
command_test.py Merge branch 'master' into fork_master 2017-03-30 20:26:11 +03:00
completion_test.py Rewrite completion system 2017-06-21 02:32:57 +02:00
diagnostic_filter_test.py Do not install aliases from future 2017-03-18 18:24:48 +01:00
event_notification_test.py Update BufferUnload test with Unicode paths 2017-07-08 14:19:27 +02:00
omni_completer_test.py Expect GetCompletions_Cache_List_Unicode test to fail 2017-09-10 16:33:24 +02:00
paths_test.py Accept capitalized name for Python executable 2017-03-28 02:12:15 +02:00
postcomplete_test.py Clean C# inserting namespace code 2017-05-17 19:44:02 +02:00
syntax_parse_test.py Do not install aliases from future 2017-03-18 18:24:48 +01:00
test_utils.py Improve path to python interpreter error handling 2017-09-21 21:17:32 +02:00
vimsupport_test.py Do not open location list at the bottom of screen 2017-09-17 20:34:52 +02:00
youcompleteme_test.py Improve path to python interpreter error handling 2017-09-21 21:17:32 +02:00