alfredodeza / pytest.vim

Runs your UnitTests with py.test displaying red/green bars and errors
274 stars 40 forks source link

looponfail when write not test file #56

Closed jaesbit closed 6 years ago

jaesbit commented 6 years ago

Hi again!

Working with :Pytest function looponfail i was forced to re-write test file instead some project file to run the test again. I think could be interesting that run pending tests, when writing any project file instead only specific test file.

alfredodeza commented 6 years ago

This is not currently possible because the support is tied to the position of the cursor. It is done like this because it would be hard (like very very hard) to get correctly what test function/class/method/file the user really intends on running if the current file is different.

The way this is done internally is by creating an autocmd tied to the buffer, like:

        autocmd! BufWritePost *.py call s:LoopProxy('function')

If the user is on a different Python file, how would the plugin know what file/buffer does it need to go to execute the test? Again, this would be plain hard to implement, if not with a buggy result. Will close because I don't think this will happen. Happy to hear thoughts/suggestions though