twisted.application.app.ApplicationRunner

Here are the examples of the python api twisted.application.app.ApplicationRunner taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

5 Examples 7

3 Source : test_twistd.py
with MIT License
from autofelix

    def test_startReactorRunsTheReactor(self):
        """
        L{startReactor} calls L{reactor.run}.
        """
        reactor = DummyReactor()
        runner = app.ApplicationRunner({
            "profile": False,
            "profiler": "profile",
            "debug": False})
        runner.startReactor(reactor, None, None)
        self.assertTrue(
            reactor.called, "startReactor did not call reactor.run()")


    def test_applicationRunnerChoosesReactorIfNone(self):

3 Source : test_twistd.py
with MIT License
from autofelix

    def test_applicationRunnerChoosesReactorIfNone(self):
        """
        L{ApplicationRunner} chooses a reactor if none is specified.
        """
        reactor = DummyReactor()
        self.patch(internet, 'reactor', reactor)
        runner = app.ApplicationRunner({
            "profile": False,
            "profiler": "profile",
            "debug": False})
        runner.startReactor(None, None, None)
        self.assertTrue(reactor.called)


    def test_applicationRunnerCapturesSignal(self):

3 Source : test_twistd.py
with MIT License
from fbla-competitive-events

    def test_startReactorRunsTheReactor(self):
        """
        L{startReactor} calls L{reactor.run}.
        """
        reactor = DummyReactor()
        runner = app.ApplicationRunner({
            "profile": False,
            "profiler": "profile",
            "debug": False})
        runner.startReactor(reactor, None, None)
        self.assertTrue(
            reactor.called, "startReactor did not call reactor.run()")



class UnixApplicationRunnerSetupEnvironmentTests(unittest.TestCase):

0 Source : test_twistd.py
with MIT License
from autofelix

    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)


    def test_applicationRunnerIgnoresNoSignal(self):

0 Source : test_twistd.py
with MIT License
from autofelix

    def test_applicationRunnerIgnoresNoSignal(self):
        """
        The runner sets its _exitSignal instance attribute to None if
        the reactor does not implement L{_ISupportsExitSignalCapturing}.
        """

        class DummyReactorWithExitSignalAttribute(object):
            """
            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
                that should be ignored.
                """
                self._exitSignal = 2

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



class UnixApplicationRunnerSetupEnvironmentTests(unittest.TestCase):