-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please consider adding pytest-assume plugin to core plugins #3439
Comments
GitMate.io thinks possibly related issues are #946 (Merging pytest-capturelog into core), #1691 (Add a changelog to pytest-dev plugin requirements), #1803 (Integrate pytest-warnings plugin into core), #1652 (plugins resolved by pip instead of core pytest packages), and #1479 (pytest silently stops importing plugins on ImportError). |
Hi @GeorgeFischhof, Thanks for the suggestion. Installing a plugin is very simple though, so I wonder if it makes sense to add this particular plugin to the core when one can just install it instead. We try to avoid adding new things to the core specially if they are already available as external plugins; usually we merge new things to the core (which is rare) when they cover something missing from the standard library (logging the more recent case). |
Btw you can use parametrize instead of yield tests: import pytest
@pytest.mark.parametrize('what', ['one', 'two'])
def test_something(what):
assert False, what Which I find much shorter and concise than |
@GeorgeFischhof a prior version of pytest supported this, but as "yield tests" turn a test into a test genertor, they are being executed at collect time instead of test run time, thus creating completely invalid and broken results as for doing multiple assertions per test - there is a basic plan to do this correctly which involves subtests, and allowing assertion-rewriting to be hook based (so assertions can be logged in a subtest instead of raised) |
Hi folks, thanks for the info, I have alredy know the parametrizing method, and saw the hooking tehnology. I had two reasons to request adding pytest-assume to core plugins. 2.) I use PyTest for functional testing as so many people does. In functional testing there is a need several times to check more things after each other (an action has several expected results, not parametrizable). BR, |
for 1) please make them aware of a) the need to actually pin versions for that to be sensible and b) the need for exploration sessions and fast-path for requesting libs and their versions in development/prototyping as for 2) currently pytest-assume is a really good solution for that, |
Just for the sake of curiosity, can you give an example of an action with several expected results? I do some functional testing but in my case I find that whenever I have a sequence of actions needed to test something, they are always dependent, in the sense that there is no reason to continue with the following steps (assertions) if a previous one has failed. @RonnyPfannschmidt what do you mean by subtests (I thought pytest didn't support it) and assertion hooks? |
@Sup3rGeo correct subtests are not supported, but i consider it a required feature for those kinds of tests |
Hi @Sup3rGeo , example:
Because a black-box functional test can be executed end to end. And everything must be checked / tested. Of course it could be called subtest as well. Here is a syntax:
It would mean that the tests with same sequence number can be executed parallelly. (for example by using xdist) And test with different numbers must executed in order of sequence. ... BR: |
@GeorgeFischhof it has to be noted that your write-up is absolutely unrelated to subtests as known by unittest - dependent tests are a different beast |
Closing because upstream plugin development remains active - as https://github.com/okken/pytest-check - and IMO it would be a mistake to freeze the featureset when people are still working out the best way to do this. |
Hi Folks,
please consider adding pytest-assume plugin to core plugins.
a few days ago I saw a nosetest using yields, and I did not understand it at first sight, checked the documentation and woking, and found that it is used to allow multiple asserts for one test case.
I checked this in PyTest with the following code:
and found that PyTest knows this, and it is deprecated ("yield tests are deprecated, and scheduled to be removed in pytest 4.0") Remoing is not problem.
But it would be good to be able write more asserts / assumes for one test case
BR,
George
The text was updated successfully, but these errors were encountered: