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 Save g:ale_python_auto_pipenv
4 let g:ale_python_auto_pipenv = 0
6 call ale#assert#SetUpLinterTest('python', 'pylint')
8 let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
9 let b:command_tail = ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
11 GivenCommandOutput ['pylint 2.3.0']
18 call ale#assert#TearDownLinterTest()
20 Execute(The pylint callbacks should return the correct default values):
21 AssertLinterCwd expand('%:p:h')
22 AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail
24 Execute(Pylint should run with the --from-stdin in new enough versions):
25 GivenCommandOutput ['pylint 2.4.0']
27 AssertLinterCwd expand('%:p:h')
28 AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail[:-3] . '--from-stdin %s'
30 Execute(The option for disabling changing directories should work):
31 let g:ale_python_pylint_change_directory = 0
34 AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail
36 Execute(The pylint executable should be configurable, and escaped properly):
37 let g:ale_python_pylint_executable = 'executable with spaces'
39 AssertLinter 'executable with spaces', ale#Escape('executable with spaces') . b:command_tail
41 Execute(The pylint command callback should let you set options):
42 let g:ale_python_pylint_options = '--some-option'
44 AssertLinter 'pylint', ale#Escape('pylint') . ' --some-option' . b:command_tail
46 Execute(The pylint callbacks shouldn't detect virtualenv directories where they don't exist):
47 call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
49 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
50 AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail
52 Execute(The pylint callbacks should detect virtualenv directories):
53 call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
54 let b:executable = ale#path#Simplify(
55 \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pylint'
58 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
59 AssertLinter b:executable, ale#Escape(b:executable) . b:command_tail
61 Execute(You should able able to use the global pylint instead):
62 call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
63 let g:ale_python_pylint_use_global = 1
65 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
66 AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail
68 Execute(Setting executable to 'pipenv' appends 'run pylint'):
69 let g:ale_python_pylint_executable = 'path/to/pipenv'
70 let g:ale_python_pylint_use_global = 1
72 AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run pylint'
73 \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
75 Execute(Pipenv is detected when python_pylint_auto_pipenv is set):
76 let g:ale_python_pylint_auto_pipenv = 1
77 call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
79 AssertLinterCwd expand('%:p:h')
80 AssertLinter 'pipenv', ale#Escape('pipenv') . ' run pylint'
81 \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
83 Execute(Setting executable to 'poetry' appends 'run pylint'):
84 let g:ale_python_pylint_executable = 'path/to/poetry'
85 let g:ale_python_pylint_use_global = 1
87 AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run pylint'
88 \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
90 Execute(poetry is detected when python_pylint_auto_poetry is set):
91 let g:ale_python_pylint_auto_poetry = 1
92 call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
94 AssertLinterCwd expand('%:p:h')
95 AssertLinter 'poetry', ale#Escape('poetry') . ' run pylint'
96 \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
98 Execute(uv is detected when python_pylint_auto_uv is set):
99 let g:ale_python_pylint_auto_uv = 1
100 call ale#test#SetFilename('../test-files/python/uv/whatever.py')
102 AssertLinterCwd expand('%:p:h')
103 AssertLinter 'uv', ale#Escape('uv') . ' run pylint'
104 \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'