summaryrefslogtreecommitdiff
path: root/test/command_callback/test_pylint_command_callback.vader
diff options
context:
space:
mode:
Diffstat (limited to 'test/command_callback/test_pylint_command_callback.vader')
-rw-r--r--test/command_callback/test_pylint_command_callback.vader38
1 files changed, 33 insertions, 5 deletions
diff --git a/test/command_callback/test_pylint_command_callback.vader b/test/command_callback/test_pylint_command_callback.vader
index 1ff8e354..f8cb5800 100644
--- a/test/command_callback/test_pylint_command_callback.vader
+++ b/test/command_callback/test_pylint_command_callback.vader
@@ -2,10 +2,12 @@ Before:
Save g:ale_python_pylint_executable
Save g:ale_python_pylint_options
Save g:ale_python_pylint_use_global
+ Save g:ale_python_pylint_change_directory
unlet! g:ale_python_pylint_executable
unlet! g:ale_python_pylint_options
unlet! g:ale_python_pylint_use_global
+ unlet! g:ale_python_pylint_change_directory
runtime ale_linters/python/pylint.vim
call ale#test#SetDirectory('/testplugin/test/command_callback')
@@ -28,6 +30,18 @@ Execute(The pylint callbacks should return the correct default values):
\ 'pylint',
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
AssertEqual
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('pylint') . ' ' . b:command_tail,
+ \ ale_linters#python#pylint#GetCommand(bufnr(''))
+
+Execute(The option for disabling changing directories should work):
+ let g:ale_python_pylint_change_directory = 0
+
+ AssertEqual
+ \ 'pylint',
+ \ ale_linters#python#pylint#GetExecutable(bufnr(''))
+ \
+ AssertEqual
\ ale#Escape('pylint') . ' ' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr(''))
@@ -38,14 +52,16 @@ Execute(The pylint executable should be configurable, and escaped properly):
\ 'executable with spaces',
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
AssertEqual
- \ ale#Escape('executable with spaces') . ' ' . b:command_tail,
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('executable with spaces') . ' ' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr(''))
Execute(The pylint command callback should let you set options):
let g:ale_python_pylint_options = '--some-option'
AssertEqual
- \ ale#Escape('pylint') . ' --some-option' . b:command_tail,
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('pylint') . ' --some-option' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr(''))
Execute(The pylint callbacks shouldn't detect virtualenv directories where they don't exist):
@@ -55,7 +71,8 @@ Execute(The pylint callbacks shouldn't detect virtualenv directories where they
\ 'pylint',
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
AssertEqual
- \ ale#Escape('pylint') . ' ' . b:command_tail,
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('pylint') . ' ' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr(''))
Execute(The pylint callbacks should detect virtualenv directories):
@@ -70,7 +87,8 @@ Execute(The pylint callbacks should detect virtualenv directories):
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
AssertEqual
- \ ale#Escape(b:executable) . ' ' . b:command_tail,
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape(b:executable) . ' ' . b:command_tail,
\ ale_linters#python#pylint#GetCommand(bufnr(''))
Execute(You should able able to use the global pylint instead):
@@ -81,5 +99,15 @@ Execute(You should able able to use the global pylint instead):
\ 'pylint',
\ ale_linters#python#pylint#GetExecutable(bufnr(''))
AssertEqual
- \ ale#Escape('pylint') . ' ' . b:command_tail,
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('pylint') . ' ' . b:command_tail,
+ \ ale_linters#python#pylint#GetCommand(bufnr(''))
+
+Execute(Setting executable to 'pipenv' appends 'run pylint'):
+ let g:ale_python_pylint_executable = 'path/to/pipenv'
+
+ AssertEqual
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('path/to/pipenv') . ' run pylint'
+ \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s',
\ ale_linters#python#pylint#GetCommand(bufnr(''))