We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32beb07 commit 091cf8fCopy full SHA for 091cf8f
atest/testdata/running/timeouts_with_logging.py
@@ -8,12 +8,21 @@
8
9
10
def rf_logger():
11
- while True:
12
- logger.info(MSG)
13
- time.sleep(0) # give time for other threads
+ _log_a_lot(logger.info)
14
15
16
def python_logging():
17
18
- logging.info(MSG)
19
+ _log_a_lot(logging.info)
+
+def _log_a_lot(info):
+ # Assigning local variables is performance optimization to give as much
20
+ # time as as possible for actual logging.
21
+ msg = MSG
22
+ sleep = time.sleep
23
+ current = time.time
24
+ end = current() + 1
25
+ while current() < end:
26
+ info(msg)
27
+ sleep(0) # give time for other threads
28
+ raise AssertionError('Execution should have been stopped by timeout.')
0 commit comments