summaryrefslogtreecommitdiff
path: root/test/command_callback/test_mypy_command_callback.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-10-08 23:26:50 +0100
committerw0rp <devw0rp@gmail.com>2017-10-08 23:26:50 +0100
commita809c4fa3a781af7401d2f11ee5155caef081457 (patch)
treeba0becb5ee2237c909e45b70f5112d35b7534bb1 /test/command_callback/test_mypy_command_callback.vader
parent65aa88a7d5d9b855f71f2b2f30cb4ae1fca63ad3 (diff)
downloadale-a809c4fa3a781af7401d2f11ee5155caef081457.zip
Get more random tests to pass on Windows
Diffstat (limited to 'test/command_callback/test_mypy_command_callback.vader')
-rw-r--r--test/command_callback/test_mypy_command_callback.vader46
1 files changed, 35 insertions, 11 deletions
diff --git a/test/command_callback/test_mypy_command_callback.vader b/test/command_callback/test_mypy_command_callback.vader
index 8df7193d..4ccc008e 100644
--- a/test/command_callback/test_mypy_command_callback.vader
+++ b/test/command_callback/test_mypy_command_callback.vader
@@ -1,20 +1,35 @@
Before:
+ Save g:ale_python_mypy_executable
+ Save g:ale_python_mypy_options
+ Save g:ale_python_mypy_use_global
+
+ unlet! g:ale_python_mypy_executable
+ unlet! g:ale_python_mypy_options
+ unlet! g:ale_python_mypy_use_global
+
+ let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
+
runtime ale_linters/python/mypy.vim
+
call ale#test#SetDirectory('/testplugin/test/command_callback')
+ call ale#test#SetFilename('test.py')
After:
+ Restore
+
+ unlet! b:bin_dir
+ unlet! b:executable
+
call ale#test#RestoreDirectory()
call ale#linter#Reset()
- let g:ale_python_mypy_executable = 'mypy'
- let g:ale_python_mypy_options = ''
- let g:ale_python_mypy_use_global = 0
Execute(The mypy callbacks should return the correct default values):
AssertEqual
\ 'mypy',
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
AssertEqual
- \ 'cd ''' . g:dir . ''' && ''mypy'' --show-column-numbers '
+ \ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('mypy')
+ \ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s',
\ ale_linters#python#mypy#GetCommand(bufnr(''))
@@ -25,7 +40,8 @@ Execute(The mypy executable should be configurable, and escaped properly):
\ 'executable with spaces',
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
AssertEqual
- \ 'cd ''' . g:dir . ''' && ''executable with spaces'' --show-column-numbers '
+ \ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('executable with spaces')
+ \ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s',
\ ale_linters#python#mypy#GetCommand(bufnr(''))
@@ -33,7 +49,8 @@ Execute(The mypy command callback should let you set options):
let g:ale_python_mypy_options = '--some-option'
AssertEqual
- \ 'cd ''' . g:dir . ''' && ''mypy'' --show-column-numbers --some-option '
+ \ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('mypy')
+ \ . ' --show-column-numbers --some-option '
\ . '--shadow-file %s %t %s',
\ ale_linters#python#mypy#GetCommand(bufnr(''))
@@ -44,19 +61,24 @@ Execute(The mypy command should switch directories to the detected project root)
\ 'mypy',
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
AssertEqual
- \ 'cd ''' . g:dir . '/python_paths/no_virtualenv/subdir'' && ''mypy'' --show-column-numbers '
+ \ 'cd ' . ale#Escape(ale#path#Winify(g:dir . '/python_paths/no_virtualenv/subdir'))
+ \ . ' && ' . ale#Escape('mypy')
+ \ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s',
\ ale_linters#python#mypy#GetCommand(bufnr(''))
Execute(The mypy callbacks should detect virtualenv directories and switch to the project root):
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
+ let b:executable = ale#path#Winify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/mypy')
+
AssertEqual
- \ g:dir . '/python_paths/with_virtualenv/env/bin/mypy',
+ \ b:executable,
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
AssertEqual
- \ 'cd ''' . g:dir . '/python_paths/with_virtualenv/subdir'' && '''
- \ . g:dir . '/python_paths/with_virtualenv/env/bin/mypy'' --show-column-numbers '
+ \ 'cd ' . ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/subdir'))
+ \ . ' && ' . ale#Escape(b:executable)
+ \ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s',
\ ale_linters#python#mypy#GetCommand(bufnr(''))
@@ -68,6 +90,8 @@ Execute(You should able able to use the global mypy instead):
\ 'mypy',
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
AssertEqual
- \ 'cd ''' . g:dir . '/python_paths/with_virtualenv/subdir'' && ''mypy'' --show-column-numbers '
+ \ 'cd ' . ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/subdir'))
+ \ . ' && ' . ale#Escape('mypy')
+ \ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s',
\ ale_linters#python#mypy#GetCommand(bufnr(''))