-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from puremourning/python
Python test
- Loading branch information
Showing
4 changed files
with
73 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"configurations": { | ||
"run": { | ||
"adapter": "vscode-python", | ||
"configuration": { | ||
"request": "launch", | ||
"type": "python", | ||
"cwd": "${workspaceRoot}", | ||
"program": "${file}", | ||
"stopOnEntry": true, | ||
"console": "integratedTerminal" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
function! SetUp() | ||
call vimspector#test#setup#SetUpWithMappings( v:none ) | ||
endfunction | ||
|
||
function! ClearDown() | ||
call vimspector#test#setup#ClearDown() | ||
endfunction | ||
|
||
function! SetUp_Test_Go_Simple() | ||
let g:vimspector_enable_mappings = 'HUMAN' | ||
endfunction | ||
|
||
function! Test_Go_Simple() | ||
let fn='main.py' | ||
lcd ../support/test/python/simple_python | ||
exe 'edit ' . fn | ||
call setpos( '.', [ 0, 6, 1 ] ) | ||
|
||
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 6, 1 ) | ||
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 6 ) | ||
|
||
" Add the breakpoint | ||
call feedkeys( "\<F9>", 'xt' ) | ||
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP', | ||
\ 6, | ||
\ 'vimspectorBP' ) | ||
|
||
call setpos( '.', [ 0, 1, 1 ] ) | ||
|
||
" Here we go. Start Debugging | ||
pyx << EOF | ||
from unittest.mock import patch | ||
with patch( 'vimspector.utils.SelectFromList', | ||
return_value=None ) as p: | ||
with patch( 'vimspector.utils.AskForInput', | ||
return_value=None ) as p: | ||
vim.eval( 'feedkeys( "\<F5>", "xt" )' ) | ||
vim.eval( 'vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 6, 1 )' ) | ||
p.assert_called() | ||
EOF | ||
|
||
" Step | ||
call feedkeys( "\<F10>", 'xt' ) | ||
|
||
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 7, 1 ) | ||
call WaitForAssert( {-> | ||
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 7 ) | ||
\ } ) | ||
|
||
call vimspector#test#setup#Reset() | ||
|
||
lcd - | ||
%bwipeout! | ||
endfunction | ||
|