summaryrefslogtreecommitdiff
path: root/test/linter/test_jedils.vader
blob: 0c2781bd6c22a093a18b0c8c9801c31ca84c21d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Before:
  call ale#assert#SetUpLinterTest('python', 'jedils')
  Save b:ale_python_auto_virtualenv

  let b:bin_dir = has('win32') ? 'Scripts' : 'bin'

After:
  unlet! b:bin_dir
  unlet! b:venv_bin
  unlet! b:sep
  unlet! b:executable

  call ale#assert#TearDownLinterTest()

Execute(The jedi-language-server command callback should return default string):
  call ale#test#SetFilename('./foo.py')

  AssertLinter 'jedi-language-server', ale#Escape('jedi-language-server')

Execute(The jedi-language-server executable should be configurable):
  let g:ale_python_jedils_executable = '~/.local/bin/jedi-language-server'

  AssertLinter '~/.local/bin/jedi-language-server' , ale#Escape('~/.local/bin/jedi-language-server')

Execute(virtualenv vars should be used when ale_python_auto_virtualenv = 1):
  let b:ale_python_auto_virtualenv = 1
  call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')

  let b:venv_bin = ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir)
  let b:sep = has('win32') ? ';' : ':'
  let b:executable = ale#path#Simplify(b:venv_bin . '/jedi-language-server')

  AssertLinter b:executable, ale#Env('PATH', b:venv_bin . b:sep . $PATH)
  \   . ale#Escape(b:executable)

Execute(You should be able to override the jedi-language-server virtualenv lookup):
  call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')

  let g:ale_python_jedils_use_global = 1

  AssertLinter 'jedi-language-server', ale#Escape('jedi-language-server')

Execute(Setting executable to 'pipenv' appends 'run jedi-language-server'):
  let g:ale_python_jedils_executable = 'path/to/pipenv'
  call ale#test#SetFilename('../test-files/dummy')

  AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run jedi-language-server'