camptocamp/pytest-odoo

Logs polluted by PIL.PngImagePlugin DEBUG log-level

grindtildeath opened this issue ยท 5 comments

When using pytest with odoo 11.0, the logs are polluted by DEBUG level logs from Pillow library.

2018-02-20 16:00:37,276 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'IHDR' 16 13
2018-02-20 16:00:37,276 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'iCCP' 41 1004
2018-02-20 16:00:37,276 1 DEBUG testdb PIL.PngImagePlugin: iCCP profile name b'icc'
2018-02-20 16:00:37,277 1 DEBUG testdb PIL.PngImagePlugin: Compression method 0
2018-02-20 16:00:37,277 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'bKGD' 1057 6
2018-02-20 16:00:37,277 1 DEBUG testdb PIL.PngImagePlugin: b'bKGD' 1057 6 (unknown)
2018-02-20 16:00:37,277 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'pHYs' 1075 9
2018-02-20 16:00:37,277 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'vpAg' 1096 9
2018-02-20 16:00:37,277 1 DEBUG testdb PIL.PngImagePlugin: b'vpAg' 1096 9 (unknown)
2018-02-20 16:00:37,277 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'IDAT' 1117 21141
2018-02-20 16:00:37,285 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'IHDR' 16 13
2018-02-20 16:00:37,286 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'IDAT' 41 16633
2018-02-20 16:00:37,286 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'IHDR' 16 13
2018-02-20 16:00:37,286 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'IDAT' 41 16633
2018-02-20 16:00:37,286 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'IHDR' 16 13
2018-02-20 16:00:37,286 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'IDAT' 41 16633
2018-02-20 16:00:37,293 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'IHDR' 16 13
2018-02-20 16:00:37,294 1 DEBUG testdb PIL.PngImagePlugin: STREAM b'IDAT' 41 16633

This happens when a user is created in the setUp() method as res.partner.create() is called with no image in vals dict : https://github.com/odoo/odoo/blob/11.0/odoo/addons/base/res/res_partner.py#L530

I have no idea why these logs appear using pytest while they don't using standard odoo --test-enable
machinery.

PS this could easily be reproduced launching pytest on account module as users are created there.

An upgrade of pytest to 3.4.2 (see the explanation on #16)

one thing that may work is setting the logging level of this module:

pil_logger = logging.getLogger('PIL')
pil_logger.setLevel(logging.INFO)

Or as a single line:

logging.getLogger('PIL').setLevel(logging.WARNING)

where is logging coming from?

where is logging coming from?

@fire717 from the Python logging module:

import logging