def test_logFileCantOpen(self):
        """
        L{TwistOptions.opt_log_file} exits with L{ExitStatus.EX_IOERR} if
        unable to open the log file due to an L{EnvironmentError}.
        """
        self.patchExit()
        self.patchOpen()

        options = TwistOptions()
        options.opt_log_file("nocanopen")

        self.assertEquals(self.exit.status, ExitStatus.EX_IOERR)
        self.assertTrue(
            self.exit.message.startswith(
                "Unable to open log file 'nocanopen': "
            )
        )

        L{TwistOptions.opt_log_file} exits with L{ExitStatus.EX_IOERR} if
        unable to open the log file due to an L{EnvironmentError}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/application/twist/test/test_options.py