All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 call ale#assert#SetUpLinterTest('python', 'unimport')
3 call ale#test#SetFilename('test.py')
5 let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
11 call ale#assert#TearDownLinterTest()
13 Execute(The unimport callbacks should return the correct default values):
14 AssertLinter 'unimport', ale#Escape('unimport') . ' --check %t'
16 Execute(The unimport executable should be configurable, and escaped properly):
17 let b:ale_python_unimport_executable = 'foobar'
19 AssertLinter 'foobar', ale#Escape('foobar') . ' --check %t'
21 Execute(The unimport command callback should let you set options):
22 let b:ale_python_unimport_options = '--gitignore'
24 AssertLinter 'unimport', ale#Escape('unimport') . ' --gitignore --check %t'
26 Execute(The unimport command should switch directories to the detected project root):
27 call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
29 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
30 AssertLinter 'unimport', ale#Escape('unimport') . ' --check %t'
32 Execute(The unimport callbacks should detect virtualenv directories and switch to the project root):
33 call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
35 let b:executable = ale#path#Simplify(
36 \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/unimport'
39 AssertLinter b:executable, ale#Escape(b:executable) . ' --check %t'
41 Execute(You should able able to use the global unimport instead):
42 call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
43 let g:ale_python_unimport_use_global = 1
45 AssertLinter 'unimport', ale#Escape('unimport') . ' --check %t'
47 Execute(Setting executable to 'pipenv' appends 'run unimport'):
48 let g:ale_python_unimport_executable = 'path/to/pipenv'
50 AssertLinterCwd expand('#' . bufnr('') . ':p:h')
51 AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run unimport --check %t'
53 Execute(Pipenv is detected when python_unimport_auto_pipenv is set):
54 call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
55 let g:ale_python_unimport_auto_pipenv = 1
57 AssertLinterCwd expand('#' . bufnr('') . ':p:h')
58 AssertLinter 'pipenv', ale#Escape('pipenv') . ' run unimport --check %t'
60 Execute(Setting executable to 'poetry' appends 'run unimport'):
61 let g:ale_python_unimport_executable = 'path/to/poetry'
63 AssertLinterCwd expand('#' . bufnr('') . ':p:h')
64 AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run unimport --check %t'
66 Execute(Poetry is detected when python_unimport_auto_poetry is set):
67 call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
68 let g:ale_python_unimport_auto_poetry = 1
70 AssertLinterCwd expand('#' . bufnr('') . ':p:h')
71 AssertLinter 'poetry', ale#Escape('poetry') . ' run unimport --check %t'
73 Execute(uv is detected when python_unimport_auto_uv is set):
74 call ale#test#SetFilename('../test-files/python/uv/whatever.py')
75 let g:ale_python_unimport_auto_uv = 1
77 AssertLinterCwd expand('#' . bufnr('') . ':p:h')
78 AssertLinter 'uv', ale#Escape('uv') . ' run unimport --check %t'