summaryrefslogtreecommitdiff
path: root/test/command_callback
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-05-07 16:31:33 +0100
committerw0rp <devw0rp@gmail.com>2017-05-07 16:31:33 +0100
commit1a157b1cd5f08d652f93defbb10f5bcc1a20a739 (patch)
tree4b641e7d25957a725d1c670a20f2498350d3a011 /test/command_callback
parent05bd4f591c3d9f53dff8beadb5468ed7a301fad4 (diff)
downloadale-1a157b1cd5f08d652f93defbb10f5bcc1a20a739.zip
Support `python -m flake8` for users who are running flake8 that way
Diffstat (limited to 'test/command_callback')
-rw-r--r--test/command_callback/test_flake8_command_callback.vader32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/command_callback/test_flake8_command_callback.vader b/test/command_callback/test_flake8_command_callback.vader
index bf4dfaff..baec5335 100644
--- a/test/command_callback/test_flake8_command_callback.vader
+++ b/test/command_callback/test_flake8_command_callback.vader
@@ -70,3 +70,35 @@ Execute(The flake8 callbacks should detect virtualenv directories):
\ g:dir . '/python_paths/with_virtualenv/env/bin/flake8'
\ . ' --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
+
+" Some users currently run flake8 this way, so we should support it.
+Execute(Using `python -m flake8` should be supported for running flake8):
+ silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
+
+ let g:ale_python_flake8_executable = 'python'
+ let g:ale_python_flake8_options = '-m flake8 --some-option'
+
+ AssertEqual
+ \ 'python',
+ \ ale_linters#python#flake8#GetExecutable(bufnr(''))
+ AssertEqual
+ \ 'python -m flake8 --version',
+ \ ale_linters#python#flake8#VersionCheck(bufnr(''))
+ AssertEqual
+ \ 'python -m flake8 --some-option -',
+ \ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
+
+ call ale_linters#python#flake8#ClearVersionCache()
+
+ " Leading spaces shouldn't matter
+ let g:ale_python_flake8_options = ' -m flake8 --some-option'
+
+ AssertEqual
+ \ 'python',
+ \ ale_linters#python#flake8#GetExecutable(bufnr(''))
+ AssertEqual
+ \ 'python -m flake8 --version',
+ \ ale_linters#python#flake8#VersionCheck(bufnr(''))
+ AssertEqual
+ \ 'python -m flake8 --some-option -',
+ \ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])