Tests and logging - pytest-capturelog

Thomas De Schampheleire patrickdepinguin at gmail.com
Mon Jun 13 18:48:22 UTC 2016


On Mon, Jun 13, 2016 at 3:08 PM, Mads Kiilerich <mads at kiilerich.com> wrote:
> On 05/29/2016 09:11 PM, Thomas De Schampheleire wrote:
>>
>> On Tue, May 24, 2016 at 9:13 PM, Mads Kiilerich <mads at kiilerich.com>
>> wrote:
>>>
>>> Hi
>>>
>>> Writing or debugging Kallithea tests can be frustrating. One reason is
>>> that
>>> there is no logging (AFAICS).
>>>
>>> I just found
>>>
>>> pip install pytest-capturelog
>>>
>>> which will make log output show up for failing tests. That seems to be
>>> very
>>> helpful! (It would perhaps be even more helpful if it showed up
>>> interleaved
>>> with stdout output ... but that is no big deal.)
>>>
>>> Does this trick work for you too? Or do you have other similar tricks?
>>
>> Works for me, nice find! I'd say: add it to the requirements.
>
>
> Hmm ...
> https://bitbucket.org/memedough/pytest-capturelog/issues/6/__multicall__-deprecated-in-upcoming
> suggests we should use pytest-catchlog instead ...
>
>>
>> In the current turbogears situation I had disabled all logging, as
>> there were some database logs that kept appearing and I did not find
>> how to silence them (and the actual test logs were not shown anyway).
>> I need to disable that disabling to benefit from pytest-capturelog, so
>> I'll need to find another solution for the annoying logs. More on that
>> later...
>
>
> It wasn't covered by test.ini setting [logger_sqlalchemy] level = ERROR ?
>

No. For example, running the 'models' tests, I see logs with the
following prefix in stdout and stderr (as captured by pytest) and for
the database setup code:

2016-06-13 18:43:57,474 INFO sqlalchemy.engine.base.Engine


More information about the kallithea-general mailing list