On Fri, Sep 24, 2021 at 11:23:00PM -0700, Guido van Rossum wrote:

> > Is there no room for making it easier to do this with less invasive
> > changes to the stdlib, or are Steven d'A's "heroic measures in an
> > import hook" the right way to go?
> >
> > Other Steve
> 
> 
> There’s room for that, but that’s not what’s being proposed (yet :-).

I'm confused. My reading of the pre-PEP is that that is precisely what 
it is proposing: changing the way assert works so that the value of each 
sub-expression is available to be displayed to the user. Presumably any 
framework or library would be able to access that information.

Have I missed something? I don't see anything in the proposal about 
creating new stdlib frameworks or changing unittest.

The reference implementation for these "Power Assertions" uses AST 
re-writing, which is similar to what pytest does:

http://pybites.blogspot.com/2011/07/behind-scenes-of-pytests-new-assertion.html

but the proposal suggests moving that into the compiler (which Serhiy 
considered doing earlier).

I don't know if pytest would actually be able to make use of that, or 
whether they would keep their own AST re-writing implementation, it 
would probably be a good thing for Noam to reach out to pytest and other 
frameworks and see if they could use this feature.

Personally, even if all we got out of this was better debugging 
information in assertions, I would be in favour. But over in Groovy 
land, the official docs are suggesting that it is often better to rely 
on power assertions rather than JUnit.

http://docs.groovy-lang.org/next/html/documentation/core-testing-guide.html#_junit_4



-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/MSPR5GLJNEVEGSGVZEG6ZB3WS4UZBJZC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to