enable postmortem mode
This commit is contained in:
parent
128b998bd2
commit
051e07f03e
1 changed files with 22 additions and 7 deletions
|
|
@ -265,7 +265,7 @@ endfunc
|
|||
nnoremap <C-m> :call MoveToNextTab()<CR><C-w>H
|
||||
nnoremap <C-n> :call MoveToPrevTab()<CR><C-w>H
|
||||
|
||||
function! RunTests(filename, test_path)
|
||||
function! RunTests(filename, test_path, debug)
|
||||
let tmux_pane = substitute(system("tmux display-message -p '#S'"),'\n','','')
|
||||
let tmux_pane_target = tmux_pane."_testing:1.0"
|
||||
echo tmux_pane_target
|
||||
|
|
@ -274,13 +274,20 @@ function! RunTests(filename, test_path)
|
|||
if l:tmux_pane == "checkout"
|
||||
" checkout uses py.test (or uh it will)
|
||||
if a:test_path != ' '
|
||||
let full_test_path = a:filename."::".a:test_path
|
||||
let pytest_path = substitute(a:test_path, "\\.", "::", "")
|
||||
let full_test_path = a:filename."::".l:pytest_path
|
||||
else
|
||||
let full_test_path = a:filename
|
||||
endif
|
||||
|
||||
if a:debug == 1
|
||||
let test_args = "-- -x --ipdb "
|
||||
else
|
||||
let test_args = ''
|
||||
endif
|
||||
|
||||
if l:full_test_path != "::"
|
||||
let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' tox ".full_test_path." 2>/dev/null' Enter"
|
||||
let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' tox ".test_args.full_test_path." 2>/dev/null' Enter"
|
||||
else
|
||||
let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' make test 2>/dev/null' Enter"
|
||||
endif
|
||||
|
|
@ -291,8 +298,15 @@ function! RunTests(filename, test_path)
|
|||
else
|
||||
let full_test_path = a:filename
|
||||
endif
|
||||
|
||||
if a:debug == 1
|
||||
let test_args = "-d "
|
||||
else
|
||||
let test_args = ''
|
||||
endif
|
||||
|
||||
if l:full_test_path != " "
|
||||
let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' testify ".full_test_path."' Enter"
|
||||
let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' testify ".test_args.full_test_path."' Enter"
|
||||
endif
|
||||
endif
|
||||
echo command
|
||||
|
|
@ -309,6 +323,7 @@ function! StoreTestPath(filename, lineno)
|
|||
endfun
|
||||
|
||||
map <LEADER>s :call StoreTestPath(expand("%"), line("."))<CR>
|
||||
map <LEADER>T :w\|:call StoreTestPath(expand("%"), line("."))<CR>\|:call RunTests(g:t, g:f)<CR>
|
||||
map <LEADER>t :w\|:call RunTests(g:t, g:f)<CR>
|
||||
map <LEADER>m :call RunTests("", "")<CR>
|
||||
map <LEADER>T :w\|:call StoreTestPath(expand("%"), line("."))<CR>\|:call RunTests(g:t, g:f, 0)<CR>
|
||||
map <LEADER>t :w\|:call RunTests(g:t, g:f, 0)<CR>
|
||||
map <LEADER>dt :w\|:call RunTests(g:t, g:f, 1)<CR>
|
||||
map <LEADER>m :call RunTests("", "", 0)<CR>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue