Fix for upstream changes in kj::Exception
* Change from using Nature/Durability to Type * Prefer to raise KjException directly instead of Value/RuntimError. * Will still raise AttributeError appropriately.
This commit is contained in:
@@ -32,7 +32,7 @@ class PipelineServer(capability.TestPipeline.Server):
|
||||
|
||||
def test_client():
|
||||
client = capability.TestInterface._new_client(Server())
|
||||
|
||||
|
||||
req = client._request('foo')
|
||||
req.i = 5
|
||||
|
||||
@@ -40,7 +40,7 @@ def test_client():
|
||||
response = remote.wait()
|
||||
|
||||
assert response.x == '26'
|
||||
|
||||
|
||||
req = client.foo_request()
|
||||
req.i = 5
|
||||
|
||||
@@ -54,7 +54,7 @@ def test_client():
|
||||
|
||||
req = client.foo_request()
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(Exception):
|
||||
req.i = 'foo'
|
||||
|
||||
req = client.foo_request()
|
||||
@@ -64,18 +64,18 @@ def test_client():
|
||||
|
||||
def test_simple_client():
|
||||
client = capability.TestInterface._new_client(Server())
|
||||
|
||||
|
||||
remote = client._send('foo', i=5)
|
||||
response = remote.wait()
|
||||
|
||||
assert response.x == '26'
|
||||
|
||||
|
||||
|
||||
remote = client.foo(i=5)
|
||||
response = remote.wait()
|
||||
|
||||
assert response.x == '26'
|
||||
|
||||
|
||||
remote = client.foo(i=5, j=True)
|
||||
response = remote.wait()
|
||||
|
||||
@@ -107,19 +107,19 @@ def test_simple_client():
|
||||
assert response.x == '5_test'
|
||||
assert response.i == 5
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(Exception):
|
||||
remote = client.foo(5, 10)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(Exception):
|
||||
remote = client.foo(5, True, 100)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(Exception):
|
||||
remote = client.foo(i='foo')
|
||||
|
||||
with pytest.raises(AttributeError):
|
||||
remote = client.foo2(i=5)
|
||||
|
||||
with pytest.raises(AttributeError):
|
||||
with pytest.raises(Exception):
|
||||
remote = client.foo(baz=5)
|
||||
|
||||
def test_pipeline():
|
||||
@@ -149,7 +149,7 @@ class BadServer(capability.TestInterface.Server):
|
||||
|
||||
def test_exception_client():
|
||||
client = capability.TestInterface._new_client(BadServer())
|
||||
|
||||
|
||||
remote = client._send('foo', i=5)
|
||||
with pytest.raises(capnp.KjException):
|
||||
remote.wait()
|
||||
@@ -267,7 +267,7 @@ def test_cancel():
|
||||
remote = req.send()
|
||||
remote.cancel()
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(Exception):
|
||||
remote.wait()
|
||||
|
||||
|
||||
@@ -301,32 +301,32 @@ def test_double_send():
|
||||
req.i = 5
|
||||
|
||||
req.send()
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(Exception):
|
||||
req.send()
|
||||
|
||||
|
||||
def test_then_args():
|
||||
capnp.Promise(0).then(lambda x: 1)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(Exception):
|
||||
capnp.Promise(0).then(lambda: 1)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(Exception):
|
||||
capnp.Promise(0).then(lambda x, y: 1)
|
||||
|
||||
capnp.getTimer().after_delay(1).then(lambda: 1) # after_delay is a VoidPromise
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(Exception):
|
||||
capnp.getTimer().after_delay(1).then(lambda x: 1)
|
||||
|
||||
client = capability.TestInterface._new_client(Server())
|
||||
|
||||
client.foo(i=5).then(lambda x: 1)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(Exception):
|
||||
client.foo(i=5).then(lambda: 1)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(Exception):
|
||||
client.foo(i=5).then(lambda x, y: 1)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user