Make accept_plugin viable, add a way to suppress assertions #57
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, I think I found a very hacky way to suppress assertions and make the
assert_plugin viable to use.
Major changes:
doctest support temporarily removed (I just didn't need it myself and its
tests seemed to leak test state in destructive ways)
the accept plugin doesn't rewrite non-literal RHS of assertions anymore. so for example
assert 1 == 3
is rewritten, butassert 1 == complexlogic()
isn't.new '--accept-continue' flag that rewrites assertions to silently pass.
consolidate '--accept-copy' and '--accept' into one flag: '--accept=overwrite' and '--accept=new'
I also noticed that .new allows you to use insta to review things after running with
--accept=new
:I originally wanted to fork this plugin, and for simplicity get rid of doctest
support that I don't need, and adjust the API a bit as well. But I thought i'd
just push this up as PR for discussion, I don't think this can be merged as-is.
Most importantly, pytest-accept now relies on private pytest APIs. So in case
you want to adopt this hack, I would suggest to add a big fat disclaimer to the
README.