Can assert in pytest have third state - not Fail, not Success, but something as warning or 'weak' fail?

Viewed 403

I have items in stock from different companies. And I do not know how to deal if numberOfItems == 0

If I do assert numberOfItems > 0 Then if there is no item in stock it fails.

However I do not want it to fail instead show warning - this can be problem or not, but should not be showstopper for deployment lets say.

Not black/white but grey result of assert.

1 Answers

I do not know if this is what you are looking for, but it helped me in a similar situation:

if numberOfItems == 0:
     pytest.skip("No items found")

There will be an output which is not PASSED, but it does not fail the run.

Related