Make test simpler
This commit is contained in:
@@ -16,13 +16,10 @@ class Server:
|
|||||||
context.results.x = str(context.params.i * 5 + self.val)
|
context.results.x = str(context.params.i * 5 + self.val)
|
||||||
|
|
||||||
class PipelineServer:
|
class PipelineServer:
|
||||||
def __init__(self, capability):
|
|
||||||
self.capability = capability
|
|
||||||
|
|
||||||
def getCap(self, context):
|
def getCap(self, context):
|
||||||
def _then(response):
|
def _then(response):
|
||||||
context.results.s = response.x + '_foo'
|
context.results.s = response.x + '_foo'
|
||||||
context.results.outBox.cap = self.capability.TestInterface.new_server(Server(100))
|
context.results.outBox.cap = capability().TestInterface.new_server(Server(100))
|
||||||
|
|
||||||
return context.params.inCap.foo(i=context.params.n).then(_then)
|
return context.params.inCap.foo(i=context.params.n).then(_then)
|
||||||
|
|
||||||
@@ -88,7 +85,7 @@ def test_simple_client(capability):
|
|||||||
def test_pipeline(capability):
|
def test_pipeline(capability):
|
||||||
loop = capnp.EventLoop()
|
loop = capnp.EventLoop()
|
||||||
|
|
||||||
client = capability.TestPipeline.new_client(PipelineServer(capability), loop)
|
client = capability.TestPipeline.new_client(PipelineServer(), loop)
|
||||||
foo_client = capability.TestInterface.new_client(Server(), loop)
|
foo_client = capability.TestInterface.new_client(Server(), loop)
|
||||||
|
|
||||||
remote = client.getCap(n=5, inCap=foo_client)
|
remote = client.getCap(n=5, inCap=foo_client)
|
||||||
@@ -101,7 +98,3 @@ def test_pipeline(capability):
|
|||||||
|
|
||||||
response = loop.wait_remote(remote)
|
response = loop.wait_remote(remote)
|
||||||
assert response.s == '26_foo'
|
assert response.s == '26_foo'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user