summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKevin Locke <kevin@kevinlocke.name>2019-02-10 08:18:55 -0700
committerKevin Locke <kevin@kevinlocke.name>2019-02-10 08:18:55 -0700
commit82b15fb7063e1c40803971159a6c1d330a585274 (patch)
treefc0191b9e18f0c8f984fdaa5e910a49b4365af7e /test
parent7a48750610bbed164750a3f0fbf0fd9e88fa56c5 (diff)
downloadale-82b15fb7063e1c40803971159a6c1d330a585274.zip
Document and test ale_python_vulture_options
The vulture linter already supports ale_python_vulture_options, but it is not documented or tested. Since vulture only supports configuration via options, it is an important use case. Add docs and test. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Diffstat (limited to 'test')
-rwxr-xr-xtest/command_callback/python_paths/with_virtualenv/env/Scripts/vulture.exe0
-rwxr-xr-xtest/command_callback/python_paths/with_virtualenv/env/bin/vulture0
-rw-r--r--test/command_callback/test_vulture_command_callback.vader68
3 files changed, 68 insertions, 0 deletions
diff --git a/test/command_callback/python_paths/with_virtualenv/env/Scripts/vulture.exe b/test/command_callback/python_paths/with_virtualenv/env/Scripts/vulture.exe
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/python_paths/with_virtualenv/env/Scripts/vulture.exe
diff --git a/test/command_callback/python_paths/with_virtualenv/env/bin/vulture b/test/command_callback/python_paths/with_virtualenv/env/bin/vulture
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/python_paths/with_virtualenv/env/bin/vulture
diff --git a/test/command_callback/test_vulture_command_callback.vader b/test/command_callback/test_vulture_command_callback.vader
new file mode 100644
index 00000000..d6c866b9
--- /dev/null
+++ b/test/command_callback/test_vulture_command_callback.vader
@@ -0,0 +1,68 @@
+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):
+ AssertLinter 'vulture',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('vulture') . ' .'
+
+Execute(The vulture command callback should lint project root, when present):
+ silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/bar.py')
+
+ AssertLinter 'vulture',
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/no_virtualenv/subdir'))
+ \ . ale#Escape('vulture') . ' .'
+
+Execute(The option for disabling change directory works and only lints file):
+ let g:ale_python_vulture_change_directory = 0
+
+ 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'
+
+ AssertLinter 'executable with spaces',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('executable with spaces') . ' .'
+
+Execute(The vulture command callback should let you set options):
+ let g:ale_python_vulture_options = '--some-option'
+
+ AssertLinter 'vulture',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('vulture') . ' --some-option .'
+
+Execute(The vulture command callback should detect virtualenv directories and switch to the project root):
+ silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
+
+ let b:executable = ale#path#Simplify(
+ \ g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/vulture'
+ \)
+
+ AssertLinter b:executable,
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir'))
+ \ . ale#Escape(b:executable) . ' .'
+
+Execute(You should able able to use the global vulture instead):
+ silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
+ let g:ale_python_vulture_use_global = 1
+
+ AssertLinter 'vulture',
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir'))
+ \ . ale#Escape('vulture') . ' .'
+
+Execute(Setting executable to 'pipenv' appends 'run vulture'):
+ let g:ale_python_vulture_executable = 'path/to/pipenv'
+
+ AssertLinter 'path/to/pipenv',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('path/to/pipenv') . ' run vulture' . ' .'