示例#1
0
    def setUp(self):

        if INTERNAL_BUS:
            os.environ['DBUS_SESSION_BUS_ADDRESS'] = (
                'unix:abstract=/tmp/txdbus-test,guid=5'
            )

            bus_obj = bus.Bus()

            f = Factory()
            f.protocol = bus.BusProtocol
            f.bus = bus_obj

            point = endpoints.getDBusEnvEndpoints(reactor, False)[0]
            d = point.listen(f)

            def got_port(port):
                self.port = port
                return self._client_connect()

            d.addCallback(got_port)

            return d
        else:
            return self._client_connect()
    def _setup(self):
        self.orig_env = os.environ['DBUS_SESSION_BUS_ADDRESS']
        
        os.environ['DBUS_SESSION_BUS_ADDRESS']='unix:abstract=/tmp/txdbus-test,guid=5'
            
        bus_obj = bus.Bus()

        f = Factory()
        f.protocol = bus.BusProtocol
        f.bus = bus_obj
        
        point = endpoints.getDBusEnvEndpoints(reactor, False)[0]
        d = point.listen(f)

        def got_port(port):
            self.port = port
        
        d.addCallback( got_port )
        
        return d
示例#3
0
    def setUp(self):
        if INTERNAL_BUS:
            os.environ[
                'DBUS_SESSION_BUS_ADDRESS'] = 'unix:abstract=/tmp/txdbus-test,guid=5'

            bus_obj = bus.Bus()

            f = Factory()
            f.protocol = bus.BusProtocol
            f.bus = bus_obj

            point = endpoints.getDBusEnvEndpoints(reactor, False)[0]
            d = point.listen(f)

            def got_port(port):
                self.port = port
                return self._client_connect()

            d.addCallback(got_port)

            return d
        else:
            return self._client_connect()