alfredodeza / pytest.vim

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

pytest-sugar #26

Closed vigten closed 9 years ago

vigten commented 9 years ago

The plugin seam need that pytest-sugar is not enabled.

alfredodeza commented 9 years ago

I am not sure what you mean. You have installed a plugin and want it enabled? or disabled? Are you getting an error? (if so of what kind?)

vigten commented 9 years ago

When I call pytest on file with pytest-sugar installed it does not find the expected errors...otherwise is behave as expected...

alfredodeza commented 9 years ago

Aha, so yes, this plugin relies on py.test output. So any plugin that alters the output (like pytest-sugar) will have unusual effects that will break the plugin.

There is no way for this plugin to reliably understand output from py.test in any other way.

My suggestion would be to disable pytest-sugar when running from the terminal. You could have pytest-sugar disable its terminal reporting or something similar? I don't use it and from briefly skimming through it doesn't look like you can.

Maybe file a feature request with the project?

(Closing for now, feel free to re-open if you think this is incorrect)

vigten commented 9 years ago

There existe a --nosugar flag.. if is possible to give flag to the defaut pytest command then the problem could be solved like that.

In general may be could be nice to put more explicit message when no test have been run, so that if other pytest plugin modify output the user can realize that there are a problem, othewise will think all tests have passed.

alfredodeza commented 9 years ago

There are explicit messages when no tests are run, but if I install pytest-sugar, tests do run, it is just that it is impossible to parse the output.

The-Compiler commented 8 years ago

Maybe pytest.vim should just pass -p no:sugar to pytest by default? That'd deactivate the sugar plugin (which is probably the common case) if it's enabled.

Also, couldn't it use pytest's junitxml output as a more robust solution?

alfredodeza commented 8 years ago

@The-Compiler it could certainly add that flag. But it is not a maintainable solution as pytest-sugar is not the only plugin out there that modifies output.

I think parsing XML output with VimScript might be a bit too much for me. It is far easier to just look at output :)

The-Compiler commented 8 years ago

"Perfect is the enemy of good" :wink:

pytest-sugar is the common culprit - for @vigten, for someone in the #pylib IRC channel just now, and it would've been for me if I didn't ditch pytest-sugar because of other issues.

The only other one I'm aware of is pytest-instafail, not sure if it makes enough of a difference to break pytest.vim.

I don't expect there to be much more, and it'd make pytest.vim work for those common cases :wink:

As a sidenote, I wonder if it'd make sense to develop a pytest plugin which dumps the test results into a file in some format easy to parse in VimScript. Then again I didn't use it (yet!), just was a random idea I had.

alfredodeza commented 8 years ago

@The-Compiler I asked a while ago about the --result-log flag, but it seems that format was never fully reliable.

The latest version of the plugin should now correctly report the inability to parse output, this was introduced recently on 9b34f637e79579cd65e0781d9cc5543df7a4e2ca

There is also a plan to allow passing flags, so having a combination of flags added by default and others that are added manually would be tricky to consolidate