'Rotating log files autorotate after a period of time, and can also be
manually rotated.'

def test_rotation(self):

    with contextlib.closing(logfile.LogFile(self.name, self.dir, rotateLength=10)) as log:
        log.write('123')
        log.write('4567890')
        log.write(('1' * 11))
        self.assertTrue(os.path.exists('{0}.1'.format(self.path)))
        self.assertFalse(os.path.exists('{0}.2'.format(self.path)))
        log.write('')
        self.assertTrue(os.path.exists('{0}.1'.format(self.path)))
        self.assertTrue(os.path.exists('{0}.2'.format(self.path)))
        self.assertFalse(os.path.exists('{0}.3'.format(self.path)))
        log.write('3')
        self.assertFalse(os.path.exists('{0}.3'.format(self.path)))
        log.rotate()
        self.assertTrue(os.path.exists('{0}.3'.format(self.path)))
        self.assertFalse(os.path.exists('{0}.4'.format(self.path)))
    self.assertEqual(log.listLogs(), [1, 2, 3])
