MCPcopy Index your code
hub / github.com/python/cpython / test_rollover_filenames

Method test_rollover_filenames

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

Source from the content-addressed store, hash-verified

6467 self.test_max_bytes(delay=True)
6468
6469 def test_rollover_filenames(self):
6470 def namer(name):
6471 return name + ".test"
6472 rh = logging.handlers.RotatingFileHandler(
6473 self.fn, encoding="utf-8", backupCount=2, maxBytes=1)
6474 rh.namer = namer
6475 rh.emit(self.next_rec())
6476 self.assertLogFile(self.fn)
6477 self.assertFalse(os.path.exists(namer(self.fn + ".1")))
6478 rh.emit(self.next_rec())
6479 self.assertLogFile(namer(self.fn + ".1"))
6480 self.assertFalse(os.path.exists(namer(self.fn + ".2")))
6481 rh.emit(self.next_rec())
6482 self.assertLogFile(namer(self.fn + ".2"))
6483 self.assertFalse(os.path.exists(namer(self.fn + ".3")))
6484 rh.emit(self.next_rec())
6485 self.assertFalse(os.path.exists(namer(self.fn + ".3")))
6486 rh.close()
6487
6488 def test_namer_rotator_inheritance(self):
6489 class HandlerWithNamerAndRotator(logging.handlers.RotatingFileHandler):

Callers

nothing calls this directly

Calls 6

next_recMethod · 0.80
assertLogFileMethod · 0.80
assertFalseMethod · 0.80
emitMethod · 0.45
existsMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected