summaryrefslogtreecommitdiff
path: root/test/fixers
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-10-16 14:02:58 +0900
committerGitHub <noreply@github.com>2021-10-16 14:02:58 +0900
commit16898417e68ffb6034b2a6de0c1b25502bd846d8 (patch)
treefcf7d1a64cb923135bf457b29362a626a9a9f3c7 /test/fixers
parentc7e3f1a0dd447eeafcbbd158974860c1918dbdd5 (diff)
downloadale-16898417e68ffb6034b2a6de0c1b25502bd846d8.zip
Fix 3941 - add version check to isort fixer (#3942)
Diffstat (limited to 'test/fixers')
-rw-r--r--test/fixers/test_isort_fixer_callback.vader39
1 files changed, 27 insertions, 12 deletions
diff --git a/test/fixers/test_isort_fixer_callback.vader b/test/fixers/test_isort_fixer_callback.vader
index 72882737..8b665d6b 100644
--- a/test/fixers/test_isort_fixer_callback.vader
+++ b/test/fixers/test_isort_fixer_callback.vader
@@ -11,45 +11,60 @@ After:
Execute(The isort callback should return the correct default values):
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
- AssertEqual
+
+ " --filename option exists only after 5.7.0
+ GivenCommandOutput ['VERSION 5.7.0']
+ AssertFixer
\ {
\ 'cwd': '%s:h',
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' --filename %s' . ' -',
- \ },
- \ ale#fixers#isort#Fix(bufnr(''))
+ \ }
Execute(The isort callback should respect custom options):
let g:ale_python_isort_options = '--multi-line=3 --trailing-comma'
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
- AssertEqual
+
+ " --filename option exists only after 5.7.0
+ GivenCommandOutput ['VERSION 5.7.0']
+ AssertFixer
\ {
\ 'cwd': '%s:h',
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort'))
\ . ' --filename %s' . ' --multi-line=3 --trailing-comma -',
- \ },
- \ ale#fixers#isort#Fix(bufnr(''))
+ \ }
Execute(Pipenv is detected when python_isort_auto_pipenv is set):
let g:ale_python_isort_auto_pipenv = 1
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
- AssertEqual
+ GivenCommandOutput ['VERSION 5.7.0']
+ AssertFixer
\ {
\ 'cwd': '%s:h',
\ 'command': ale#Escape('pipenv') . ' run isort' . ' --filename %s' . ' -'
- \ },
- \ ale#fixers#isort#Fix(bufnr(''))
+ \ }
Execute(Poetry is detected when python_isort_auto_poetry is set):
let g:ale_python_isort_auto_poetry = 1
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
- AssertEqual
+ GivenCommandOutput ['VERSION 5.7.0']
+ AssertFixer
\ {
\ 'cwd': '%s:h',
\ 'command': ale#Escape('poetry') . ' run isort' . ' --filename %s' . ' -'
- \ },
- \ ale#fixers#isort#Fix(bufnr(''))
+ \ }
+
+Execute(The isort callback should not use --filename for older versions):
+ silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
+
+ " --filename option exists only after 5.7.0
+ GivenCommandOutput ['VERSION 5.6.0']
+ AssertFixer
+ \ {
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -',
+ \ }