forked from vim-test/vim-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnose.vim
More file actions
51 lines (44 loc) · 1.34 KB
/
nose.vim
File metadata and controls
51 lines (44 loc) · 1.34 KB
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
48
49
50
51
if !exists('g:test#python#nose#file_pattern')
let g:test#python#nose#file_pattern = '\v(^|[\b_\.-])[Tt]est.*\.py$'
endif
function! test#python#nose#test_file(file) abort
if fnamemodify(a:file, ':t') =~# g:test#python#nose#file_pattern
if exists('g:test#python#runner')
return g:test#python#runner ==# 'nose'
else
return executable('nosetests')
endif
endif
endfunction
function! test#python#nose#build_position(type, position) abort
if a:type ==# 'nearest'
let name = s:nearest_test(a:position)
if !empty(name)
return [a:position['file'].':'.name]
else
return [a:position['file']]
endif
elseif a:type ==# 'file'
return [a:position['file']]
else
return []
endif
endfunction
function! test#python#nose#build_args(args) abort
return ['--doctest-tests'] + a:args
endfunction
function! test#python#nose#executable() abort
let pipenv_prefix = ""
if filereadable("Pipfile")
let pipenv_prefix = "pipenv run "
elseif filereadable("poetry.lock")
let pipenv_prefix = "poetry run "
elseif filereadable("uv.lock")
let pipenv_prefix = "uv run "
endif
return pipenv_prefix . "nosetests"
endfunction
function! s:nearest_test(position) abort
let name = test#base#nearest_test(a:position, g:test#python#patterns)
return join(name['namespace'] + name['test'], '.')
endfunction