[pytest-dev] pytest 3.1 warning capture woes

RonnyPfannschmidt opensource at ronnypfannschmidt.de
Tue May 30 05:40:58 EDT 2017



Am 30.05.2017 um 11:13 schrieb Florian Bruhin:
> On Mon, May 29, 2017 at 08:26:42PM +0200, RonnyPfannschmidt wrote:
>> Hi everyone,
>>
>> while taking a closer look and trying to understand what cpython does, i
>> stumbled upon
>> https://github.com/python/cpython/blob/v3.6.1/Lib/unittest/main.py#L77
>>
>> so their default runner just crudely pushes a simplefilter onto the
>> complete system with an crude extra in
>>
>> https://github.com/python/cpython/blob/v3.6.1/Lib/unittest/runner.py#L159
>>
>> by now i do believe to just blindly show any deprecation is going to be
>> a massive disservice to the users (because they do use libraries)
>>
>> - i believe it should e left to the library-authors to pick what exact
>> warnings to show
> 
> I'd still be in favour of turning them on by default, if that's possible
> without clashing with existing filters. I don't think it's the job of
> libraries to modify warning filters - they already do do decide to show
> those warnings, otherwise they wouldn't emit them in the first place.
> 
> Other test runners already show them. There's even some discussion about
> showing them by default in the REPL, and ipython already seems to do
> that:
> http://bugs.python.org/issue24294
> https://github.com/ipython/ipython/issues/8478
> 
> If we don't show them, nobody will see them, and they won't be fixed
> before stuff breaks for real. I've reported so many bugs to libraries
> which used deprecated stuff - they didn't see the warnings because they
> were using pytest with the default settings, and I did because I was
> using pytest-warnings. But things shouldn't be that way.

py.test should enable its own warnings so people see them
py.test is the "library", so py.test enables the filters

> 
> As a data point, looks like it was the same for pytest-asyncio:
> https://github.com/pytest-dev/pytest-asyncio/pull/51
> 
> Florian
> 


More information about the pytest-dev mailing list