alfredodeza / pytest.vim

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

Allow to pass options to py.test #33

Closed blueyed closed 7 years ago

blueyed commented 8 years ago

It would be useful for :Pytest --testmon to pass the --testmon option to py.test.

Additionally some setting could be used for default options?

alfredodeza commented 8 years ago

I am not sure what --testmon is/does but the general idea behind this plugin is to be able to control the output as much as possible because it parses it. The parsing is crucial for all the functionality behind the plugin and allowing arbitrary flags being passed in can potentially alter the output and break the plugin.

pytest.vim can also break when py.test plugins that alter output by default are used (as seen in issue #26 )

Alternatively, you can always add more flags in a conftest.py file, but then again, you might break pytest.vim if it alters the output.

blueyed commented 8 years ago

Yes, I see that it might break things, but you should still allow for it probably.

As for --testmon, it allows to filter tests according to coverage (https://github.com/tarpas/pytest-testmon), so I would like to use it of course (for the project scope), but not necessarily in conftest / setup.cfg.

alfredodeza commented 8 years ago

There is no way to safely and programmatically allow certain flags and disallow certain others. I am unsure how to best support your use case without breaking for others. But I do welcome any ideas on how to solve this in a robust way.

blueyed commented 8 years ago

I would just allow for them to be passed: it's the user's responsibility then I would say. Regarding the formatting, you could pass the required ones afterwards to override any options from the user in this regard.

alfredodeza commented 8 years ago

I have thought about this and I think I will allow extra options passed in. Mainly because we are already implicitly allowing it via conftest.py (and similar files) so you are right in that it should be up to the user to understand if they are passing the right flags or breaking the plugin.

alfredodeza commented 8 years ago

@blueyed would you mind trying out the extra-flags branch and tell me how it works for you? I added support for everything except running the whole project.

dbedrenko commented 8 years ago

I'm trying the extra-flags branch, but I'm not sure I'm calling it properly. If I run :Pytest class --quiet tests still succeed and :Pytest session shows normal output, instead of quiet output.

alfredodeza commented 8 years ago

@Spaghetti-Cat that is probably because internally the plugin enforces the reporting type so it can parse the output. Using --quiet would break this. Can you try with another/different flag?

alfredodeza commented 8 years ago

@blueyed ping? Mind taking a look at the work in the extra-flags branch?

alfredodeza commented 7 years ago

I am closing this since @blueyed didn't confirm that the extra-flags branch would work. Feel free to re-open otherwise. Thanks!