Add missing docstrings.
This commit is contained in:
parent
94bc10405a
commit
2dcf323077
@ -156,6 +156,7 @@ class TestLogTime(unittest.TestCase):
|
||||
"""Test log_time."""
|
||||
|
||||
def test_log_time(self):
|
||||
"""Test if log_time logs properly."""
|
||||
logger = logging.getLogger('qt-tests')
|
||||
with self.assertLogs(logger, logging.DEBUG) as logged:
|
||||
with debug.log_time(logger, action='foobar'):
|
||||
|
@ -254,6 +254,12 @@ def format_call(func, args=None, kwargs=None, full=True):
|
||||
|
||||
@contextlib.contextmanager
|
||||
def log_time(logger, action='operation'):
|
||||
"""Log the time the operation in the with-block takes.
|
||||
|
||||
Args:
|
||||
logger: The logging.Logger to use for logging.
|
||||
action: A description of what's being done.
|
||||
"""
|
||||
started = datetime.datetime.now()
|
||||
yield
|
||||
finished = datetime.datetime.now()
|
||||
|
Loading…
Reference in New Issue
Block a user