]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/linter/test_pycln.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / test / linter / test_pycln.vader
1 Before:
2   Save g:ale_python_auto_pipenv
3
4   let g:ale_python_auto_pipenv = 0
5
6   call ale#assert#SetUpLinterTest('python', 'pycln')
7
8   let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
9   let b:cmd_tail = ' --check -'
10
11   GivenCommandOutput ['pycln, version 1.3.0']
12
13 After:
14   unlet! b:bin_dir
15   unlet! b:executable
16   unlet! b:cmd_tail
17
18   call ale#assert#TearDownLinterTest()
19
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
23
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']
27
28   AssertLinterCwd expand('%:p:h')
29   AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail[:-3] . ' %s'
30
31 Execute(pycln should run with the stdin in new enough versions):
32   GivenCommandOutput ['pycln, version 1.3.0']
33
34   AssertLinterCwd expand('%:p:h')
35   AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail[:-3] . ' -'
36
37 Execute(The option for disabling changing directories should work):
38   let g:ale_python_pycln_change_directory = 0
39
40   AssertLinterCwd ''
41   AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail
42
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'
46
47   AssertLinter 'foo', ale#Escape('foo') . ' --some-flag' . b:cmd_tail
48
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')
51
52   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
53   AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail
54
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'
59   \)
60   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
61   AssertLinter b:executable, ale#Escape(b:executable) . b:cmd_tail
62
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
66
67   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
68   AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail
69
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
73
74   AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run pycln'
75   \   . b:cmd_tail
76
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')
80
81   AssertLinterCwd expand('%:p:h')
82   AssertLinter 'pipenv', ale#Escape('pipenv') . ' run pycln'
83   \   . b:cmd_tail
84
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
88
89   AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run pycln'
90   \   . b:cmd_tail
91
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')
95
96   AssertLinterCwd expand('%:p:h')
97   AssertLinter 'poetry', ale#Escape('poetry') . ' run pycln'
98   \   . b:cmd_tail
99
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')
103
104   AssertLinterCwd expand('%:p:h')
105   AssertLinter 'uv', ale#Escape('uv') . ' run pycln'
106   \   . b:cmd_tail
107
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')
110
111   AssertLinter 'pycln',
112   \ ale#Escape('pycln')
113   \ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/pycln/other_config.xml'))
114   \ . b:cmd_tail
115
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'
119
120   AssertLinter 'pycln', ale#Escape('pycln') . ' --config /bar.xml' . b:cmd_tail
121
122   let b:ale_python_pycln_options = '-x --config /bar.xml'
123
124   AssertLinter 'pycln', ale#Escape('pycln') . ' -x --config /bar.xml' . b:cmd_tail