2019-02-10 15:18:55 +00:00
|
|
|
Before:
|
|
|
|
call ale#assert#SetUpLinterTest('python', 'vulture')
|
|
|
|
call ale#test#SetFilename('test.py')
|
|
|
|
|
|
|
|
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
|
|
|
|
|
|
|
After:
|
|
|
|
unlet! b:bin_dir
|
|
|
|
unlet! b:executable
|
|
|
|
|
|
|
|
call ale#assert#TearDownLinterTest()
|
|
|
|
|
|
|
|
Execute(The vulture command callback should lint file directory by default):
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinterCwd expand('#' . bufnr('') . ':p:h')
|
|
|
|
AssertLinter 'vulture', ale#Escape('vulture') . ' .'
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
Execute(The vulture command callback should lint project root, when present):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
|
2019-02-10 15:18:55 +00:00
|
|
|
|
2021-03-20 22:11:22 +00:00
|
|
|
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinter 'vulture', ale#Escape('vulture') . ' .'
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
Execute(The option for disabling change directory works and only lints file):
|
|
|
|
let g:ale_python_vulture_change_directory = 0
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinterCwd ''
|
2019-02-10 15:18:55 +00:00
|
|
|
AssertLinter 'vulture', ale#Escape('vulture') . ' %s'
|
|
|
|
|
|
|
|
Execute(The vulture executable should be configurable, and escaped properly):
|
|
|
|
let g:ale_python_vulture_executable = 'executable with spaces'
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinter 'executable with spaces', ale#Escape('executable with spaces') . ' .'
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
Execute(The vulture command callback should let you set options):
|
|
|
|
let g:ale_python_vulture_options = '--some-option'
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinter 'vulture', ale#Escape('vulture') . ' --some-option .'
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
Execute(The vulture command callback should detect virtualenv directories and switch to the project root):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
let b:executable = ale#path#Simplify(
|
2021-03-20 22:11:22 +00:00
|
|
|
\ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/vulture'
|
2019-02-10 15:18:55 +00:00
|
|
|
\)
|
|
|
|
|
2021-03-20 22:11:22 +00:00
|
|
|
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinter b:executable, ale#Escape(b:executable) . ' .'
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
Execute(You should able able to use the global vulture instead):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
2019-02-10 15:18:55 +00:00
|
|
|
let g:ale_python_vulture_use_global = 1
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinter 'vulture', ale#Escape('vulture') . ' .'
|
2019-02-10 15:18:55 +00:00
|
|
|
|
|
|
|
Execute(Setting executable to 'pipenv' appends 'run vulture'):
|
|
|
|
let g:ale_python_vulture_executable = 'path/to/pipenv'
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run vulture' . ' .'
|
2021-07-25 04:39:05 +00:00
|
|
|
Execute(Setting executable to 'poetry' appends 'run vulture'):
|
|
|
|
let g:ale_python_vulture_executable = 'path/to/poetry'
|
|
|
|
|
|
|
|
AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run vulture' . ' .'
|