From 160a9cb238d80f95c05e9e1a9f9b9de9fd13eed0 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Fri, 14 Jun 2019 11:50:07 +0100 Subject: [PATCH] fix doctest calling configLogger causing flakiness of other tests since we use pytest-randomly to randomize the test execution, depending on when this specific test is executed, it may have the side effect of configuring the global logging configuration, causing other tests that capture logging messages to fail. E.g. see https://travis-ci.org/fonttools/fonttools/jobs/545680550 --- Lib/fontTools/misc/loggingTools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/fontTools/misc/loggingTools.py b/Lib/fontTools/misc/loggingTools.py index b00fff0d3..b4b9a9b05 100644 --- a/Lib/fontTools/misc/loggingTools.py +++ b/Lib/fontTools/misc/loggingTools.py @@ -250,8 +250,8 @@ class Timer(object): upon exiting the with-statement. >>> import logging - >>> log = logging.getLogger("fontTools") - >>> configLogger(level="DEBUG", format="%(message)s", stream=sys.stdout) + >>> log = logging.getLogger("my-fancy-timer-logger") + >>> configLogger(logger=log, level="DEBUG", format="%(message)s", stream=sys.stdout) >>> with Timer(log, 'do something'): ... time.sleep(0.01) Took ... to do something