Closed ArmandBENETEAU closed 2 years ago
Good job, but now it remains to finalize the server part so that you can write tests and you have to write tests.
Good job, but now it remains to finalize the server part so that you can write tests and you have to write tests.
Yeah, I agree with that at 100%!
But as I've said, I have task with higher priority right now in my company, so I guess that this pull request will have to wait until beginning of 2022.
Unfortunately, these changes broke the existing tests.
Unfortunately, these changes broke the existing tests.
Yeah, I will try to have a look on what is breaking the test...
This new commit should fix the tests. Indeed I made a mistake in the __call__
method of _Method
class.
IMHO this change also requires a change in the README.md, because the current client-example no longer works:
# Or via __getitem__
method = client['args']
print(await method(1, 2, 3))
Or am I missing something?
@m-bucher Oups! Indeed you are right, since we are not using the __getitem__
function anymore, this example is broken...
We could replace this part of README.md by:
print(await client.args(1, 2, 3))
The code modification done here is largely inspired by what is done in the 'xmlrpc' built-in python library.
The code mechanism is about creating a "_Method" class that handle the "nested" calls (e.g.
A.foo()
).In order to keep the
close()
method as it was before, an exception is added in the__getattr__()
function of theServerProxy
class.Signed-off-by: Armand Bénéteau armand.beneteau@iot.bzh