]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/linter/test_pylama.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:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / linter / test_pylama.vader
1 Before:
2   call ale#assert#SetUpLinterTest('python', 'pylama')
3   call ale#test#SetFilename('test.py')
4
5   let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
6   let b:command_tail = ' %s'
7
8 After:
9   unlet! b:bin_dir
10   unlet! b:executable
11   unlet! b:command_tail
12
13   call ale#assert#TearDownLinterTest()
14
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
18
19 Execute(The option for disabling changing directories should work):
20   let g:ale_python_pylama_change_directory = 0
21
22   AssertLinterCwd ''
23   AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail
24
25 Execute(The pylama executable should be configurable, and escaped properly):
26   let g:ale_python_pylama_executable = 'executable with spaces'
27
28   AssertLinterCwd ale#path#Simplify(g:dir)
29   AssertLinter 'executable with spaces',
30   \ ale#Escape('executable with spaces') . b:command_tail
31
32 Execute(The pylama command callback should let you set options):
33   let g:ale_python_pylama_options = '--some-option'
34
35   AssertLinterCwd ale#path#Simplify(g:dir)
36   AssertLinter 'pylama', ale#Escape('pylama') . ' --some-option' . b:command_tail
37
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')
40
41   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
42   AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail
43
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')
46
47   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
48   AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail
49
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'
54   \)
55
56   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
57   AssertLinter b:executable, ale#Escape(b:executable) . b:command_tail
58
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
62
63   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
64   AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail
65
66 Execute(Setting executable to 'pipenv' appends 'run pylama'):
67   let g:ale_python_pylama_executable = 'path/to/pipenv'
68
69   AssertLinter 'path/to/pipenv',
70   \ ale#Escape('path/to/pipenv') . ' run pylama' . b:command_tail
71
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')
75
76   AssertLinter 'pipenv', ale#Escape('pipenv') . ' run pylama' . b:command_tail
77
78 Execute(Setting executable to 'poetry' appends 'run pylama'):
79   let g:ale_python_pylama_executable = 'path/to/poetry'
80
81   AssertLinter 'path/to/poetry',
82   \ ale#Escape('path/to/poetry') . ' run pylama' . b:command_tail
83
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')
87
88   AssertLinter 'poetry', ale#Escape('poetry') . ' run pylama' . b:command_tail
89
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')
93
94   AssertLinter 'uv', ale#Escape('uv') . ' run pylama' . b:command_tail