def test_applicationRunnerCapturesSignal(self):
        """
        If the reactor exits with a signal, the application runner caches
        the signal.
        """

        class DummyReactorWithSignal(ReactorBase):
            """
            A dummy reactor, providing a C{run} method, and setting the
            _exitSignal attribute to a nonzero value.
            """

            def installWaker(self):
                """
                Dummy method, does nothing.
                """

            def run(self):
                """
                A fake run method setting _exitSignal to a nonzero value
                """
                self._exitSignal = 2

        reactor = DummyReactorWithSignal()
        runner = app.ApplicationRunner({
            "profile": False,
            "profiler": "profile",
            "debug": False})
        runner.startReactor(reactor, None, None)
        self.assertEquals(2, runner._exitSignal)

        If the reactor exits with a signal, the application runner caches
        the signal.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_twistd.py