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:
Jason Paryani
2014-11-30 14:27:10 -08:00
parent 42c0424e6e
commit b9c9c6bc5c
8 changed files with 171 additions and 175 deletions

View File

@@ -31,7 +31,7 @@ class PipelineServer:
def test_client_context(capability):
client = capability.TestInterface._new_client(Server())
req = client._request('foo')
req.i = 5
@@ -39,7 +39,7 @@ def test_client_context(capability):
response = remote.wait()
assert response.x == '26'
req = client.foo_request()
req.i = 5
@@ -53,7 +53,7 @@ def test_client_context(capability):
req = client.foo_request()
with pytest.raises(ValueError):
with pytest.raises(Exception):
req.i = 'foo'
req = client.foo_request()
@@ -63,18 +63,18 @@ def test_client_context(capability):
def test_simple_client_context(capability):
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()
@@ -100,19 +100,19 @@ def test_simple_client_context(capability):
assert response.x == 'localhost_test'
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_context(capability):
@@ -140,7 +140,7 @@ class BadServer:
def test_exception_client_context(capability):
client = capability.TestInterface._new_client(BadServer())
remote = client._send('foo', i=5)
with pytest.raises(capnp.KjException):
remote.wait()