pytest-assume icon indicating copy to clipboard operation
pytest-assume copied to clipboard

Make it work with already existing assertions

Open blueyed opened this issue 5 years ago • 2 comments

I think it would be very useful to turn existing asserts into assumptions sometimes temporarily, e.g. with a test where you want to see all assertion failures, without disabling/commenting them.

I've thought about suggesting this for pytest itself, but then remembered this plugin.

Do you think it is possible to change / override pytest's assertion's on-demand?

To be clear: my use case is turning this behavior on via some flag on demand, and I know that it is useful for certain kinds of tests only.

blueyed avatar May 20 '19 12:05 blueyed

I think this would likely be very closely related to #4 , at least in regards to location/type of work required. I think it would need to be an AST rewrite because (as far as I know) there's no good way to catch all AssertionErrors in a test, and resume at that point it happened.

astraw38 avatar May 20 '19 17:05 astraw38

It would make sense to merge this plugin to pytest core as a "soft assertion" feature and indeed have this in the assertion rewrite module.

Sup3rGeo avatar Jul 29 '19 13:07 Sup3rGeo