2017-05-06 18:11:43 +00:00
|
|
|
Before:
|
2017-10-08 22:26:50 +00:00
|
|
|
Save g:ale_python_pylint_executable
|
|
|
|
Save g:ale_python_pylint_options
|
|
|
|
Save g:ale_python_pylint_use_global
|
|
|
|
|
|
|
|
unlet! g:ale_python_pylint_executable
|
|
|
|
unlet! g:ale_python_pylint_options
|
|
|
|
unlet! g:ale_python_pylint_use_global
|
|
|
|
|
2017-05-06 18:11:43 +00:00
|
|
|
runtime ale_linters/python/pylint.vim
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
|
|
|
|
2017-10-08 22:26:50 +00:00
|
|
|
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
|
|
|
|
2017-05-06 18:30:41 +00:00
|
|
|
let b:command_tail = ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
|
2017-05-06 18:11:43 +00:00
|
|
|
|
|
|
|
After:
|
2017-10-08 22:26:50 +00:00
|
|
|
Restore
|
|
|
|
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#RestoreDirectory()
|
2017-05-06 18:11:43 +00:00
|
|
|
call ale#linter#Reset()
|
2017-10-08 22:26:50 +00:00
|
|
|
|
|
|
|
unlet! b:bin_dir
|
|
|
|
unlet! b:executable
|
2017-05-06 18:11:43 +00:00
|
|
|
|
|
|
|
Execute(The pylint callbacks should return the correct default values):
|
|
|
|
AssertEqual
|
|
|
|
\ 'pylint',
|
|
|
|
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
|
|
|
|
AssertEqual
|
2018-04-09 07:41:35 +00:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . ale#Escape('pylint') . ' ' . b:command_tail,
|
2017-05-06 18:11:43 +00:00
|
|
|
\ ale_linters#python#pylint#GetCommand(bufnr(''))
|
|
|
|
|
2017-05-06 20:20:02 +00:00
|
|
|
Execute(The pylint executable should be configurable, and escaped properly):
|
|
|
|
let g:ale_python_pylint_executable = 'executable with spaces'
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'executable with spaces',
|
|
|
|
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
|
|
|
|
AssertEqual
|
2018-04-09 07:41:35 +00:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . ale#Escape('executable with spaces') . ' ' . b:command_tail,
|
2017-05-06 20:20:02 +00:00
|
|
|
\ ale_linters#python#pylint#GetCommand(bufnr(''))
|
|
|
|
|
2017-05-06 18:11:43 +00:00
|
|
|
Execute(The pylint command callback should let you set options):
|
|
|
|
let g:ale_python_pylint_options = '--some-option'
|
|
|
|
|
|
|
|
AssertEqual
|
2018-04-09 07:41:35 +00:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . ale#Escape('pylint') . ' --some-option' . b:command_tail,
|
2017-05-06 18:11:43 +00:00
|
|
|
\ ale_linters#python#pylint#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The pylint callbacks shouldn't detect virtualenv directories where they don't exist):
|
|
|
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/bar.py')
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'pylint',
|
|
|
|
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
|
|
|
|
AssertEqual
|
2018-04-09 07:41:35 +00:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . ale#Escape('pylint') . ' ' . b:command_tail,
|
2017-05-06 18:11:43 +00:00
|
|
|
\ ale_linters#python#pylint#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The pylint callbacks should detect virtualenv directories):
|
|
|
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
|
|
|
|
2017-12-19 18:23:09 +00:00
|
|
|
let b:executable = ale#path#Simplify(
|
2017-10-08 22:26:50 +00:00
|
|
|
\ g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/pylint'
|
|
|
|
\)
|
|
|
|
|
2017-05-06 18:11:43 +00:00
|
|
|
AssertEqual
|
2017-10-08 22:26:50 +00:00
|
|
|
\ b:executable,
|
2017-05-06 18:11:43 +00:00
|
|
|
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
|
2017-10-08 22:26:50 +00:00
|
|
|
|
2017-05-06 18:11:43 +00:00
|
|
|
AssertEqual
|
2018-04-09 07:41:35 +00:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . ale#Escape(b:executable) . ' ' . b:command_tail,
|
2017-05-06 18:11:43 +00:00
|
|
|
\ ale_linters#python#pylint#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(You should able able to use the global pylint instead):
|
|
|
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
|
|
|
let g:ale_python_pylint_use_global = 1
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'pylint',
|
|
|
|
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
|
|
|
|
AssertEqual
|
2018-04-09 07:41:35 +00:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . ale#Escape('pylint') . ' ' . b:command_tail,
|
2017-05-06 18:11:43 +00:00
|
|
|
\ ale_linters#python#pylint#GetCommand(bufnr(''))
|