Removing deprecated Restorer and ezRestore references
- Not recommended to be used in new designs - Just pollutes warning messages during compilation (hiding ones that should be fixed) - Updated test code to use bootstrap - Sped up some of the test code that was just sleeping while waiting for the server (now polling for the socket)
This commit is contained in:
@@ -44,7 +44,7 @@ class Server(test_capability_capnp.TestInterface.Server):
|
||||
'''
|
||||
Server
|
||||
'''
|
||||
def __init__(self, val=1):
|
||||
def __init__(self, val=100):
|
||||
self.val = val
|
||||
|
||||
def foo(self, i, j, **kwargs):
|
||||
@@ -54,19 +54,6 @@ class Server(test_capability_capnp.TestInterface.Server):
|
||||
return str(i * 5 + self.val)
|
||||
|
||||
|
||||
class SimpleRestorer(test_capability_capnp.TestSturdyRefObjectId.Restorer):
|
||||
'''
|
||||
SimpleRestorer
|
||||
'''
|
||||
|
||||
def restore(self, ref_id):
|
||||
'''
|
||||
Restore
|
||||
'''
|
||||
assert ref_id.tag == 'testInterface'
|
||||
return Server(100)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
platform.python_implementation() == 'PyPy',
|
||||
reason="pycapnp's GIL handling isn't working properly at the moment for PyPy"
|
||||
@@ -81,8 +68,7 @@ def test_using_threads():
|
||||
read, write = socket.socketpair(socket.AF_UNIX)
|
||||
|
||||
def run_server():
|
||||
restorer = SimpleRestorer()
|
||||
_ = capnp.TwoPartyServer(write, restorer)
|
||||
_ = capnp.TwoPartyServer(write, bootstrap=Server())
|
||||
capnp.wait_forever()
|
||||
|
||||
server_thread = threading.Thread(target=run_server)
|
||||
@@ -90,10 +76,7 @@ def test_using_threads():
|
||||
server_thread.start()
|
||||
|
||||
client = capnp.TwoPartyClient(read)
|
||||
|
||||
ref = test_capability_capnp.TestSturdyRefObjectId.new_message(tag='testInterface')
|
||||
cap = client.restore(ref)
|
||||
cap = cap.cast_as(test_capability_capnp.TestInterface)
|
||||
cap = client.bootstrap().cast_as(test_capability_capnp.TestInterface)
|
||||
|
||||
remote = cap.foo(i=5)
|
||||
response = remote.wait()
|
||||
|
||||
Reference in New Issue
Block a user