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', 'pycln')
8 let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
9 let b:cmd_tail = ' --check -'
11 GivenCommandOutput ['pycln, version 1.3.0']
18 call ale#assert#TearDownLinterTest()
20 Execute(The pycln callbacks should return the correct default values):
21 AssertLinterCwd expand('%:p:h')
22 AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail
24 Execute(pycln should run with the file path of buffer in old versions):
25 " version `1.3.0` supports liniting input from stdin
26 GivenCommandOutput ['pycln, version 1.2.99']
28 AssertLinterCwd expand('%:p:h')
29 AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail[:-3] . ' %s'
31 Execute(pycln should run with the stdin in new enough versions):
32 GivenCommandOutput ['pycln, version 1.3.0']
34 AssertLinterCwd expand('%:p:h')
35 AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail[:-3] . ' -'
37 Execute(The option for disabling changing directories should work):
38 let g:ale_python_pycln_change_directory = 0
41 AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail
43 Execute(The pycln executable and options should be configurable):
44 let g:ale_python_pycln_executable = 'foo'
45 let g:ale_python_pycln_options = '--some-flag'
47 AssertLinter 'foo', ale#Escape('foo') . ' --some-flag' . b:cmd_tail
49 Execute(The pycln callbacks shouldn't detect virtualenv directories where they don't exist):
50 call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
52 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
53 AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail
55 Execute(The pycln callbacks should detect virtualenv directories):
56 call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
57 let b:executable = ale#path#Simplify(
58 \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln'
60 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
61 AssertLinter b:executable, ale#Escape(b:executable) . b:cmd_tail
63 Execute(You should able able to use the global pycln instead):
64 call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
65 let g:ale_python_pycln_use_global = 1
67 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
68 AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail
70 Execute(Setting executable to 'pipenv' appends 'run pycln'):
71 let g:ale_python_pycln_executable = 'path/to/pipenv'
72 let g:ale_python_pycln_use_global = 1
74 AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run pycln'
77 Execute(Pipenv is detected when python_pycln_auto_pipenv is set):
78 let g:ale_python_pycln_auto_pipenv = 1
79 call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
81 AssertLinterCwd expand('%:p:h')
82 AssertLinter 'pipenv', ale#Escape('pipenv') . ' run pycln'
85 Execute(Setting executable to 'poetry' appends 'run pycln'):
86 let g:ale_python_pycln_executable = 'path/to/poetry'
87 let g:ale_python_pycln_use_global = 1
89 AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run pycln'
92 Execute(poetry is detected when python_pycln_auto_poetry is set):
93 let g:ale_python_pycln_auto_poetry = 1
94 call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
96 AssertLinterCwd expand('%:p:h')
97 AssertLinter 'poetry', ale#Escape('poetry') . ' run pycln'
100 Execute(uv is detected when python_pycln_auto_uv is set):
101 let g:ale_python_pycln_auto_uv = 1
102 call ale#test#SetFilename('../test-files/python/uv/whatever.py')
104 AssertLinterCwd expand('%:p:h')
105 AssertLinter 'uv', ale#Escape('uv') . ' run pycln'
108 Execute(configuration files set in _config should be supported):
109 let g:ale_python_pycln_config_file = ale#path#Simplify(g:dir . '/../test-files/pycln/other_config.xml')
111 AssertLinter 'pycln',
112 \ ale#Escape('pycln')
113 \ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/pycln/other_config.xml'))
116 Execute(configuration file set in _options overrides _config):
117 let g:ale_python_pycln_config_file = '/foo.xml'
118 let g:ale_python_pycln_options = '--config /bar.xml'
120 AssertLinter 'pycln', ale#Escape('pycln') . ' --config /bar.xml' . b:cmd_tail
122 let b:ale_python_pycln_options = '-x --config /bar.xml'
124 AssertLinter 'pycln', ale#Escape('pycln') . ' -x --config /bar.xml' . b:cmd_tail