diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-06-01 09:26:44 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-06-01 09:26:44 +0200 |
commit | 19077d22e78f93212445c6969045e736b4a466d7 (patch) | |
tree | 484d4b0dc9a791c9f8f0c4b3dbf212856aba1f55 /python/test | |
parent | Updated recursive mutex check (diff) | |
download | ice-19077d22e78f93212445c6969045e736b4a466d7.tar.bz2 ice-19077d22e78f93212445c6969045e736b4a466d7.tar.xz ice-19077d22e78f93212445c6969045e736b4a466d7.zip |
Fixed ICE-7941 - scheduleCallback now provides the connection to the dispatcher work item, fixed naming of AsyncResult private methods
Diffstat (limited to 'python/test')
-rw-r--r-- | python/test/Ice/ami/AllTests.py | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/python/test/Ice/ami/AllTests.py b/python/test/Ice/ami/AllTests.py index 36d20450bf7..3b8a902a8e5 100644 --- a/python/test/Ice/ami/AllTests.py +++ b/python/test/Ice/ami/AllTests.py @@ -7,7 +7,7 @@ # # ********************************************************************** -import Ice, Test, sys, threading, random +import Ice, Test, sys, threading, random, logging def test(b): if not b: @@ -373,6 +373,11 @@ class Thrower(CallbackBase): throwEx(self._t) def allTests(communicator, collocated): + # Ice.Future uses the Python logging facility, this tests throws exceptions from Ice.Future callbacks + # so we disable errors to prevent them to show up on the console. + logging.basicConfig() + logging.disable(logging.ERROR) + sref = "test:default -p 12010" obj = communicator.stringToProxy(sref) test(obj) @@ -708,18 +713,60 @@ def allTests(communicator, collocated): p.begin_op(cb.op, cb.noEx) cb.check() + def thrower(future): + try: + future.result() + except: + test(false) + throwEx(t) + f = p.opAsync() + f.add_done_callback(thrower) + f.add_done_callback_async(thrower) + f.result() + p.begin_op(lambda: cb.opWC(cookie), lambda ex: cb.noExWC(ex, cookie)) cb.check() q.begin_op(cb.op, cb.ex) cb.check() + f = q.opAsync() + def throwerEx(future): + try: + future.result() + test(false) + except: + throwEx(t) + try: + f.add_done_callback(throwerEx) + except Exception as ex: + try: + throwEx(t) + except Exception as ex2: + test(type(ex) == type(ex2)) + f.add_done_callback_async(throwerEx) + try: + f.result() + except: + pass + q.begin_op(lambda: cb.opWC(cookie), lambda ex: cb.exWC(ex, cookie)) cb.check() p.begin_op(cb.noOp, cb.ex, cb.sent) cb.check() + f = p.opAsync() + try: + f.add_sent_callback(lambda f, s: throwEx(t)) + except Exception as ex: + try: + throwEx(t) + except Exception as ex2: + test(type(ex) == type(ex2)) + #f.add_sent_callback_async(throwerSent) + f.result() + p.begin_op(lambda: cb.noOpWC(cookie), lambda ex: cb.exWC(ex, cookie), lambda ss: cb.sentWC(ss, cookie)) cb.check() |