summaryrefslogtreecommitdiff
path: root/test/command_callback/test_flake8_command_callback.vader
diff options
context:
space:
mode:
Diffstat (limited to 'test/command_callback/test_flake8_command_callback.vader')
-rw-r--r--test/command_callback/test_flake8_command_callback.vader57
1 files changed, 30 insertions, 27 deletions
diff --git a/test/command_callback/test_flake8_command_callback.vader b/test/command_callback/test_flake8_command_callback.vader
index 1784b81f..1cc50836 100644
--- a/test/command_callback/test_flake8_command_callback.vader
+++ b/test/command_callback/test_flake8_command_callback.vader
@@ -2,11 +2,13 @@ Before:
Save g:ale_python_flake8_executable
Save g:ale_python_flake8_options
Save g:ale_python_flake8_use_global
+ Save g:ale_python_flake8_change_directory
unlet! g:ale_python_flake8_executable
unlet! g:ale_python_flake8_args
unlet! g:ale_python_flake8_options
unlet! g:ale_python_flake8_use_global
+ unlet! g:ale_python_flake8_change_directory
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
@@ -33,20 +35,30 @@ Execute(The flake8 callbacks should return the correct default values):
\ ale#Escape('flake8') . ' --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
" Try with older versions.
call ale#semver#ResetVersionCache()
AssertEqual
- \ ale#Escape('flake8') . ' --format=default -',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('flake8') . ' --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
+Execute(The option for disabling changing directories should work):
+ let g:ale_python_flake8_change_directory = 0
+
+ AssertEqual
+ \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
+ \ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
+
Execute(The flake8 command callback should let you set options):
let g:ale_python_flake8_options = '--some-option'
AssertEqual
- \ ale#Escape('flake8')
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('flake8')
\ . ' --some-option --format=default'
\ . ' --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.4'])
@@ -54,7 +66,8 @@ Execute(The flake8 command callback should let you set options):
call ale#semver#ResetVersionCache()
AssertEqual
- \ ale#Escape('flake8')
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('flake8')
\ . ' --some-option --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
@@ -68,7 +81,8 @@ Execute(You should be able to set a custom executable and it should be escaped):
\ ale#Escape('executable with spaces') . ' --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ ale#Escape('executable with spaces')
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('executable with spaces')
\ . ' --format=default'
\ . ' --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
@@ -87,7 +101,8 @@ Execute(The flake8 callbacks should detect virtualenv directories):
\ ale#Escape(b:executable) . ' --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ ale#Escape(b:executable)
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape(b:executable)
\ . ' --format=default --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
@@ -140,7 +155,8 @@ Execute(Using `python -m flake8` should be supported for running flake8):
\ ale#Escape('python') . ' -m flake8 --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ ale#Escape('python') . ' -m flake8 --some-option --format=default -',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('python') . ' -m flake8 --some-option --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
call ale#semver#ResetVersionCache()
@@ -155,27 +171,14 @@ Execute(Using `python -m flake8` should be supported for running flake8):
\ ale#Escape('python') . ' -m flake8 --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ ale#Escape('python') . ' -m flake8 --some-option --format=default -',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('python') . ' -m flake8 --some-option --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
-Execute(Using `python2 -m flake8` should be supported with the old args option):
- let g:ale_python_flake8_executable = 'python2'
- let g:ale_python_flake8_args = '-m flake8'
- let g:ale_python_flake8_use_global = 0
-
- unlet! g:ale_python_flake8_options
+Execute(Setting executable to 'pipenv' appends 'run flake8'):
+ let g:ale_python_flake8_executable = 'path/to/pipenv'
- call ale#linter#Reset()
- runtime ale_linters/python/flake8.vim
-
- silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
-
- AssertEqual
- \ 'python2',
- \ ale_linters#python#flake8#GetExecutable(bufnr(''))
AssertEqual
- \ ale#Escape('python2') . ' -m flake8 --version',
- \ ale_linters#python#flake8#VersionCheck(bufnr(''))
- AssertEqual
- \ ale#Escape('python2') . ' -m flake8 --format=default -',
- \ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('path/to/pipenv') . ' run flake8 --format=default --stdin-display-name %s -',
+ \ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])