Add missing docstrings.
This commit is contained in:
parent
94bc10405a
commit
2dcf323077
@ -156,6 +156,7 @@ class TestLogTime(unittest.TestCase):
|
|||||||
"""Test log_time."""
|
"""Test log_time."""
|
||||||
|
|
||||||
def test_log_time(self):
|
def test_log_time(self):
|
||||||
|
"""Test if log_time logs properly."""
|
||||||
logger = logging.getLogger('qt-tests')
|
logger = logging.getLogger('qt-tests')
|
||||||
with self.assertLogs(logger, logging.DEBUG) as logged:
|
with self.assertLogs(logger, logging.DEBUG) as logged:
|
||||||
with debug.log_time(logger, action='foobar'):
|
with debug.log_time(logger, action='foobar'):
|
||||||
|
@ -254,6 +254,12 @@ def format_call(func, args=None, kwargs=None, full=True):
|
|||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def log_time(logger, action='operation'):
|
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()
|
started = datetime.datetime.now()
|
||||||
yield
|
yield
|
||||||
finished = datetime.datetime.now()
|
finished = datetime.datetime.now()
|
||||||
|
Loading…
Reference in New Issue
Block a user