]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/linter/test_pylint.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_pylint.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', 'pylint')
7
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'
10
11   GivenCommandOutput ['pylint 2.3.0']
12
13 After:
14   unlet! b:bin_dir
15   unlet! b:executable
16   unlet! b:command_tail
17
18   call ale#assert#TearDownLinterTest()
19
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
23
24 Execute(Pylint should run with the --from-stdin in new enough versions):
25   GivenCommandOutput ['pylint 2.4.0']
26
27   AssertLinterCwd expand('%:p:h')
28   AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail[:-3] . '--from-stdin %s'
29
30 Execute(The option for disabling changing directories should work):
31   let g:ale_python_pylint_change_directory = 0
32
33   AssertLinterCwd ''
34   AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail
35
36 Execute(The pylint executable should be configurable, and escaped properly):
37   let g:ale_python_pylint_executable = 'executable with spaces'
38
39   AssertLinter 'executable with spaces', ale#Escape('executable with spaces') . b:command_tail
40
41 Execute(The pylint command callback should let you set options):
42   let g:ale_python_pylint_options = '--some-option'
43
44   AssertLinter 'pylint', ale#Escape('pylint') . ' --some-option' . b:command_tail
45
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')
48
49   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
50   AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail
51
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'
56   \)
57
58   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
59   AssertLinter b:executable, ale#Escape(b:executable) . b:command_tail
60
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
64
65   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
66   AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail
67
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
71
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'
74
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')
78
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'
82
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
86
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'
89
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')
93
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'
97
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')
101
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'