mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-09 21:12:31 +08:00
#2172 - Expand PATH in the shell for automatic virtualenv
This commit is contained in:
@@ -31,8 +31,9 @@ Execute(virtualenv vars should be used when ale_python_auto_virtualenv = 1):
|
||||
let b:sep = has('win32') ? ';' : ':'
|
||||
let b:executable = ale#path#Simplify(b:venv_bin . '/jedi-language-server')
|
||||
|
||||
AssertLinter b:executable, ale#Env('PATH', b:venv_bin . b:sep . $PATH)
|
||||
AssertLinter b:executable, ale#python#AutoVirtualenvEnvString(bufnr(''))
|
||||
\ . ale#Escape(b:executable)
|
||||
Assert !empty(ale#python#AutoVirtualenvEnvString(bufnr('')))
|
||||
|
||||
Execute(You should be able to override the jedi-language-server virtualenv lookup):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
@@ -52,8 +52,9 @@ Execute(virtualenv vars should be used when ale_python_auto_virtualenv = 1):
|
||||
let b:sep = has('win32') ? ';' : ':'
|
||||
let b:executable = ale#path#Simplify(b:venv_bin . '/pylsp')
|
||||
|
||||
AssertLinter b:executable, ale#Env('PATH', b:venv_bin . b:sep . $PATH)
|
||||
AssertLinter b:executable, ale#python#AutoVirtualenvEnvString(bufnr(''))
|
||||
\ . ale#Escape(b:executable)
|
||||
Assert !empty(ale#python#AutoVirtualenvEnvString(bufnr('')))
|
||||
|
||||
Execute(You should be able to override the pylsp virtualenv lookup):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
@@ -144,8 +144,9 @@ Execute(virtualenv vars should be used when ale_python_auto_virtualenv = 1):
|
||||
let b:sep = has('win32') ? ';' : ':'
|
||||
let b:executable = ale#path#Simplify(b:venv_bin . '/pyright-langserver')
|
||||
|
||||
AssertLinter b:executable, ale#Env('PATH', b:venv_bin . b:sep . $PATH)
|
||||
AssertLinter b:executable, ale#python#AutoVirtualenvEnvString(bufnr(''))
|
||||
\ . ale#Escape(b:executable) . ' --stdio'
|
||||
Assert !empty(ale#python#AutoVirtualenvEnvString(bufnr('')))
|
||||
|
||||
Execute(Setting executable to 'pipenv' should append 'run pyright'):
|
||||
call ale#test#SetFilename('../test-files')
|
||||
|
||||
@@ -10,3 +10,14 @@ Execute(ale#python#FindVirtualenv falls back to $VIRTUAL_ENV when no directories
|
||||
\ ale#python#FindVirtualenv(bufnr('%')),
|
||||
\ '/opt/example/',
|
||||
\ 'Expected VIRTUAL_ENV environment variable to be used, but it was not'
|
||||
|
||||
Execute(ale#python#AutoVirtualenvEnvString should return the correct values):
|
||||
if has('win32')
|
||||
AssertEqual
|
||||
\ 'set PATH=/opt/example/;%PATH% && ',
|
||||
\ ale#python#AutoVirtualenvEnvString(bufnr(''))
|
||||
else
|
||||
AssertEqual
|
||||
\ 'PATH=''/opt/example/''":$PATH" ',
|
||||
\ ale#python#AutoVirtualenvEnvString(bufnr(''))
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user