def runReactor(self, app, reactor):
        """
        Register the app, run the reactor, make sure app was activated, and
        that reactor was running, and that reactor can be stopped.
        """
        if not hasattr(app, "quit"):
            raise SkipTest("Version of PyGObject is too old.")

        result = []
        def stop():
            result.append("stopped")
            reactor.stop()
        def activate(widget):
            result.append("activated")
            reactor.callLater(0, stop)
        app.connect('activate', activate)

        # We want reactor.stop() to *always* stop the event loop, even if
        # someone has called hold() on the application and never done the
        # corresponding release() -- for more details see
        # http://developer.gnome.org/gio/unstable/GApplication.html.
        app.hold()

        reactor.registerGApplication(app)
        ReactorBuilder.runReactor(self, reactor)
        self.assertEqual(result, ["activated", "stopped"])

        Register the app, run the reactor, make sure app was activated, and
        that reactor was running, and that reactor can be stopped.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_gireactor.py