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
This commit is contained in:
Cosimo Lupo 2019-06-14 11:50:07 +01:00
parent 1fc1d2f529
commit 160a9cb238
No known key found for this signature in database
GPG Key ID: 20D4A261E4A0E642

View File

@ -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