[TIP] [ANN] pytest.vim (py.test and vim integration)

Alfredo Deza alfredodeza at gmail.com
Sat Jan 29 10:38:48 PST 2011

On Sat, Jan 29, 2011 at 11:39 AM, Florian Leitner
<florian.leitner at gmail.com> wrote:
> Hi Alfredo,
> Great plugin - just one comment; there is an error in  vimtest.vim as downloaded from vim.org (v 0.2):
> function! s:ThisFile(verbose)
>    echo "Running tests for entire file "
>    let abspath     = s:CurrentPath()
>    if (a:verbose == 1)
>        call s:RunInSplitWindow(path)
>    else
>        call s:RunPyTest(path)
>    endif
> endfunction
> As you can see, path gets never set, while abspath gets never used. Maybe you want to update that. Otherwise, thanks for sharing!!!

Yes indeed. After fixing some stuff last night I introduced this by
mistake. I truly hate the lack of (proper) UnitTesting support for VIM

So I fixed the error above, plus added better error messaging.

Either when the plugin can't match a class or a method or when a
py.test error happens.

version 0.3 is out and since pics are better, I have a few screen
grabs for the plugin in action:

Error Message:

Failures with line numbers:

Verbose Mode:

> --Florian
> On Jan 28, 2011, at 18:40 , Alfredo Deza wrote:
>> Hi
>> After talking a bit with Holger yesterday I went ahead and got a VIM
>> plugin working that integrates py.test into the editor.
>> Link: http://www.vim.org/scripts/script.php?script_id=3424
>> You can basically run tests for the:
>> * current class
>> * current method
>> * current file
>> When tests pass you get a green bar at the bottom of your session:
>> http://www.flickr.com/photos/aldegaz/5395135539
>> And when you fail you get a red bar but also the line numbers of all the
>> failed test errors along with the errors:
>> http://www.flickr.com/photos/aldegaz/5395135575
>> This is handy if you are trying to do something along the "red, green,
>> refactor"
>> testing style.
>> I grabbed a couple of Gary Bernhardt's functions living in his .vimrc (mostly
>> for the green and red bars) and was also inspired to see his own version
>> of this setup working in a KataCast a while ago:
>> http://katas.softwarecraftsmanship.org/?p=128
>> If there are any VIM + py.test users I am sure you will find useful the idea of
>> not having to move back and forth from the editor to the terminal.
>> I am expecting bugs and issues so feel free to bug me about them in
>> the issue tracker:
>> https://github.com/alfredodeza/pytest.vim/issues
>> And the project itself lives in GitHub:
>> https://github.com/alfredodeza/pytest.vim
>> Thanks!
>> _______________________________________________
>> testing-in-python mailing list
>> testing-in-python at lists.idyll.org
>> http://lists.idyll.org/listinfo/testing-in-python
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python

More information about the testing-in-python mailing list