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#SetUpLinterTest('python', 'mypy')
3 call ale#test#SetFilename('test.py')
5 let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
11 call ale#assert#TearDownLinterTest()
13 Execute(The mypy callbacks should return the correct default values):
17 \ . ' --show-column-numbers'
18 \ . ' --shadow-file %s %t %s'
20 Execute(The mypy executable should be configurable, and escaped properly):
21 let g:ale_python_mypy_executable = 'executable with spaces'
23 AssertLinter 'executable with spaces',
24 \ ale#Escape('executable with spaces')
25 \ . ' --show-column-numbers'
26 \ . ' --shadow-file %s %t %s'
28 Execute(The mypy command callback should let you set options):
29 let g:ale_python_mypy_options = '--some-option'
34 \ . ' --show-column-numbers'
35 \ . ' --shadow-file %s %t %s'
37 Execute(The mypy command should switch directories to the detected project root):
38 call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
40 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
43 \ . ' --show-column-numbers'
44 \ . ' --shadow-file %s %t %s'
46 Execute(The mypy callbacks should detect virtualenv directories and switch to the project root):
47 call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
49 let b:executable = ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/mypy')
51 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
52 AssertLinter b:executable,
53 \ ale#Escape(b:executable)
54 \ . ' --show-column-numbers'
55 \ . ' --shadow-file %s %t %s'
57 Execute(The mypy callbacks should cd to directory containing mypy.ini if found):
58 call ale#test#SetFilename('../test-files/python/with_mypy_ini_and_pytest_ini/tests/testsubfolder/my_tests.py')
60 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_mypy_ini_and_pytest_ini')
63 \ . ' --show-column-numbers'
64 \ . ' --shadow-file %s %t %s'
66 Execute(You should able able to use the global mypy instead):
67 call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
68 let g:ale_python_mypy_use_global = 1
70 AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir')
73 \ . ' --show-column-numbers'
74 \ . ' --shadow-file %s %t %s'
76 Execute(Setting executable to 'pipenv' appends 'run mypy'):
77 let g:ale_python_mypy_executable = 'path/to/pipenv'
79 AssertLinterCwd expand('#' . bufnr('') . ':p:h')
80 AssertLinter 'path/to/pipenv',
81 \ ale#Escape('path/to/pipenv') . ' run mypy'
82 \ . ' --show-column-numbers --shadow-file %s %t %s'
84 Execute(Pipenv is detected when python_mypy_auto_pipenv is set):
85 call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
86 let g:ale_python_mypy_auto_pipenv = 1
88 AssertLinterCwd expand('#' . bufnr('') . ':p:h')
89 AssertLinter 'pipenv',
90 \ ale#Escape('pipenv') . ' run mypy --show-column-numbers --shadow-file %s %t %s'
92 Execute(Setting executable to 'poetry' appends 'run mypy'):
93 let g:ale_python_mypy_executable = 'path/to/poetry'
95 AssertLinterCwd expand('#' . bufnr('') . ':p:h')
96 AssertLinter 'path/to/poetry',
97 \ ale#Escape('path/to/poetry') . ' run mypy'
98 \ . ' --show-column-numbers --shadow-file %s %t %s'
100 Execute(Poetry is detected when python_mypy_auto_poetry is set):
101 call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
102 let g:ale_python_mypy_auto_poetry = 1
104 AssertLinterCwd expand('#' . bufnr('') . ':p:h')
105 AssertLinter 'poetry',
106 \ ale#Escape('poetry') . ' run mypy --show-column-numbers --shadow-file %s %t %s'
108 Execute(uv is detected when python_mypy_auto_uv is set):
109 call ale#test#SetFilename('../test-files/python/uv/whatever.py')
110 let g:ale_python_mypy_auto_uv = 1
112 AssertLinterCwd expand('#' . bufnr('') . ':p:h')
114 \ ale#Escape('uv') . ' run mypy --show-column-numbers --shadow-file %s %t %s'