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#SetUpFixerTest('python', 'pycln')
4 let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
6 let b:cmd_tail = ' --silence'
8 call ale#assert#TearDownFixerTest()
13 Execute(The pycln callback should return the correct default values):
14 let file_path = g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py'
16 silent execute 'file ' . fnameescape(file_path)
18 GivenCommandOutput ['pycln, version 1.3.0']
21 \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
22 \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln')) . b:cmd_tail . ' -',
25 Execute(The pycln callback should not use stdin for older versions (< 1.3.0)):
26 let file_path = g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py'
28 silent execute 'file ' . fnameescape(file_path)
30 GivenCommandOutput ['pycln, version 1.2.99']
33 \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
34 \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln')) . b:cmd_tail . ' %s',
37 Execute(The pycln callback should not change directory if the option is set to 0):
38 let g:ale_python_pycln_change_directory = 0
40 let file_path = g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py'
42 silent execute 'file ' . fnameescape(file_path)
44 let fname = ale#Escape(ale#path#Simplify(file_path))
46 GivenCommandOutput ['pycln, version 1.3.0']
50 \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln')) . b:cmd_tail . ' -',
53 Execute(The pycln callback should respect custom options):
54 let g:ale_python_pycln_options = '--expand-stars --no-gitignore'
56 let file_path = g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py'
58 silent execute 'file ' . fnameescape(file_path)
60 GivenCommandOutput ['pycln, version 1.3.0']
63 \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
64 \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pycln'))
65 \ . ' --expand-stars --no-gitignore' . b:cmd_tail . ' -',
68 Execute(Pipenv is detected when python_pycln_auto_pipenv is set):
69 let g:ale_python_pycln_auto_pipenv = 1
70 let g:ale_python_pycln_change_directory = 0
72 let file_path = '../test-files/python/pipenv/whatever.py'
74 call ale#test#SetFilename(file_path)
76 GivenCommandOutput ['pycln, version 1.3.0']
80 \ 'command': ale#Escape('pipenv') . ' run pycln' . b:cmd_tail . ' -'
83 Execute(Poetry is detected when python_pycln_auto_poetry is set):
84 let g:ale_python_pycln_auto_poetry = 1
85 let g:ale_python_pycln_change_directory = 0
87 call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
89 GivenCommandOutput ['pycln, version 1.3.0']
93 \ 'command': ale#Escape('poetry') . ' run pycln' . b:cmd_tail . ' -'
96 Execute(Poetry is detected when python_pycln_auto_poetry is set, and cwd respects change_directory option):
97 let g:ale_python_pycln_auto_poetry = 1
98 let g:ale_python_pycln_change_directory = 1
100 call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
102 GivenCommandOutput ['pycln, version 1.3.0']
105 \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/poetry'),
106 \ 'command': ale#Escape('poetry') . ' run pycln' . b:cmd_tail . ' -'
109 Execute(uv is detected when python_pycln_auto_uv is set):
110 let g:ale_python_pycln_auto_uv = 1
111 let g:ale_python_pycln_change_directory = 0
113 call ale#test#SetFilename('../test-files/python/uv/whatever.py')
115 GivenCommandOutput ['pycln, version 1.3.0']
119 \ 'command': ale#Escape('uv') . ' run pycln' . b:cmd_tail . ' -'
122 Execute(configuration files set in _config should be supported):
123 let g:ale_python_pycln_change_directory = 0
124 let g:ale_python_pycln_config_file = ale#path#Simplify(g:dir . '/../test-files/pycln/other_config.xml')
126 GivenCommandOutput ['pycln, version 1.3.0']
130 \ 'command': ale#Escape('pycln')
131 \ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/pycln/other_config.xml'))
132 \ . b:cmd_tail . ' -'
135 Execute(configuration file set in _options overrides _config):
136 let g:ale_python_pycln_change_directory = 0
137 let g:ale_python_pycln_config_file = '/foo.xml'
138 let g:ale_python_pycln_options = '--config /bar.xml'
140 GivenCommandOutput ['pycln, version 1.3.0']
144 \ 'command': ale#Escape('pycln') . ' --config /bar.xml' . b:cmd_tail . ' -'
147 let b:ale_python_pycln_options = '-x --config /bar.xml'
152 \ 'command': ale#Escape('pycln') . ' -x --config /bar.xml' . b:cmd_tail . ' -'