HomeSoftware Heritage

cli: Ensure tests don't mess with the global logging setup

Description

cli: Ensure tests don't mess with the global logging setup

Notably, using logging.config.dictConfig disables all loggers before
setting its own config. There's no simple way of undoing these changes
to the logging config.

Even if we had a way to reset a basic logging config, pytest reuses its
log handler instances across tests, so it's not even that simple to be
able to reset the logging config from scratch and still have pytest able
to capture logs.

Instead of any of that, just add a fixture to reset the root logger
level, and to mock logging.config.dictConfig so that it doesn't actually
get called.

Details

Provenance
olasdAuthored on Apr 14 2022, 3:19 PM
olasdPushed on Apr 15 2022, 12:47 PM
Differential Revision
D7580: sentry: always override init settings with the environment variables
Parents
rDCORE8f2cfa886c2f: gunicorn: disable sentry logging event reporting by default
Branches
Unknown
Tags
Unknown
Build Status
Buildable 28499
Build 44560: test-and-buildJenkins console · Jenkins