def test_rotatePermissionDirectoryNotOk(self):
        """
        L{DailyLogFile.rotate} doesn't do anything if the directory containing
        the log files can't be written to.
        """
        log = logfile.DailyLogFile(self.name, self.dir)
        self.addCleanup(log.close)

        os.chmod(log.directory, 0o444)
        # Restore permissions so tests can be cleaned up.
        self.addCleanup(os.chmod, log.directory, 0o755)
        previousFile = log._file
        log.rotate()
        self.assertEqual(previousFile, log._file)

        L{DailyLogFile.rotate} doesn't do anything if the directory containing
        the log files can't be written to.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_logfile.py