MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_flush

Method test_flush

Lib/test/test_logging.py:1166–1192  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1164 BaseTest.tearDown(self)
1165
1166 def test_flush(self):
1167 # The memory handler flushes to its target handler based on specific
1168 # criteria (message count and message level).
1169 self.mem_logger.debug(self.next_message())
1170 self.assert_log_lines([])
1171 self.mem_logger.info(self.next_message())
1172 self.assert_log_lines([])
1173 # This will flush because the level is >= logging.WARNING
1174 self.mem_logger.warning(self.next_message())
1175 lines = [
1176 ('DEBUG', '1'),
1177 ('INFO', '2'),
1178 ('WARNING', '3'),
1179 ]
1180 self.assert_log_lines(lines)
1181 for n in (4, 14):
1182 for i in range(9):
1183 self.mem_logger.debug(self.next_message())
1184 self.assert_log_lines(lines)
1185 # This will flush because it's the 10th message since the last
1186 # flush.
1187 self.mem_logger.debug(self.next_message())
1188 lines = lines + [('DEBUG', str(i)) for i in range(n, n + 10)]
1189 self.assert_log_lines(lines)
1190
1191 self.mem_logger.debug(self.next_message())
1192 self.assert_log_lines(lines)
1193
1194 def test_flush_on_close(self):
1195 """

Callers

nothing calls this directly

Calls 6

strFunction · 0.85
next_messageMethod · 0.80
assert_log_linesMethod · 0.80
debugMethod · 0.45
infoMethod · 0.45
warningMethod · 0.45

Tested by

no test coverage detected