Exemple #1
0
 def testClientWaitsUntilServerIsUp(self):
     my_server = py_server.Server()
     my_client = client.Client(my_server.address)
     f = my_client.futures.no_args()
     my_server.Bind('no_args', lambda: 1000)
     my_server.Start()
     self.assertEqual(f.result(), 1000)
     my_server.Stop()
Exemple #2
0
    def setUp(self):
        super(PyIntegrationTest, self).setUp()
        self._server = py_server.Server()
        self._server.Bind('no_args', lambda: 1000)
        self._server.Bind('lambda_add', lambda a, b: a + b)
        self._server.Bind('method_add', _A().add)
        self._server.Bind('add_default', lambda a, b=100: a + b)

        def _exception_method():
            raise ValueError('Exception method called')

        self._server.Bind('exception_method', _exception_method)
        self._server.Bind('slow_method', lambda: time.sleep(5))
        self._server.Bind('rebind', lambda: 1234)
        self._server.Bind('bytes_value', lambda: b'1234')
        self._server.Bind('unicode_value', lambda: u'1234')
        self._server.Start()

        self._client = client.Client(self._server.address)
Exemple #3
0
 def testUnicodeAddress(self):
     client.Client(u'test')
     py_server.Server(u'test')