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', 'pylama')
3 call ale#test#SetFilename('test.py')
5 let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
6 let b:command_tail = ' %s'
13 call ale#assert#TearDownLinterTest()
15 Execute(The default pylama command should be correct):
16 AssertLinterCwd ale#path#Simplify(g:dir)
17 AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail
19 Execute(The option for disabling changing directories should work):
20 let g:ale_python_pylama_change_directory = 0
23 AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail
25 Execute(The pylama executable should be configurable, and escaped properly):
26 let g:ale_python_pylama_executable = 'executable with spaces'
28 AssertLinterCwd ale#path#Simplify(g:dir)
29 AssertLinter 'executable with spaces',
30 \ ale#Escape('executable with spaces') . b:command_tail
32 Execute(The pylama command callback should let you set options):
33 let g:ale_python_pylama_options = '--some-option'
35 AssertLinterCwd ale#path#Simplify(g:dir)
36 AssertLinter 'pylama', ale#Escape('pylama') . ' --some-option' . b:command_tail
38 Execute(The pylama command callback should switch directories to the detected project root):
39 silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/no_virtualenv/subdir/foo/bar.py')
41 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
42 AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail
44 Execute(The pylama command callback shouldn't detect virtualenv directories where they don't exist):
45 call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
47 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
48 AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail
50 Execute(The pylama command callback should detect virtualenv directories and switch to the project root):
51 call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
52 let b:executable = ale#path#Simplify(
53 \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pylama'
56 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
57 AssertLinter b:executable, ale#Escape(b:executable) . b:command_tail
59 Execute(You should able able to use the global pylama instead):
60 call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
61 let g:ale_python_pylama_use_global = 1
63 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
64 AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail
66 Execute(Setting executable to 'pipenv' appends 'run pylama'):
67 let g:ale_python_pylama_executable = 'path/to/pipenv'
69 AssertLinter 'path/to/pipenv',
70 \ ale#Escape('path/to/pipenv') . ' run pylama' . b:command_tail
72 Execute(Pipenv is detected when python_pylama_auto_pipenv is set):
73 let g:ale_python_pylama_auto_pipenv = 1
74 call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
76 AssertLinter 'pipenv', ale#Escape('pipenv') . ' run pylama' . b:command_tail
78 Execute(Setting executable to 'poetry' appends 'run pylama'):
79 let g:ale_python_pylama_executable = 'path/to/poetry'
81 AssertLinter 'path/to/poetry',
82 \ ale#Escape('path/to/poetry') . ' run pylama' . b:command_tail
84 Execute(poetry is detected when python_pylama_auto_poetry is set):
85 let g:ale_python_pylama_auto_poetry = 1
86 call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
88 AssertLinter 'poetry', ale#Escape('poetry') . ' run pylama' . b:command_tail
90 Execute(uv is detected when python_pylama_auto_uv is set):
91 let g:ale_python_pylama_auto_uv = 1
92 call ale#test#SetFilename('../test-files/python/uv/whatever.py')
94 AssertLinter 'uv', ale#Escape('uv') . ' run pylama' . b:command_tail