diff options
author | Jose <jose@zeroc.com> | 2018-08-06 11:56:42 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2018-08-06 11:56:42 +0200 |
commit | 7972f07a3aa244dcde673b7cb5541e70da9193bb (patch) | |
tree | 117faced1bb36ac256c7d362e11ac1c49e8e8c88 /python/test/Ice/slicing/exceptions | |
parent | Update JavaScript tests to use TestHelper class (diff) | |
download | ice-7972f07a3aa244dcde673b7cb5541e70da9193bb.tar.bz2 ice-7972f07a3aa244dcde673b7cb5541e70da9193bb.tar.xz ice-7972f07a3aa244dcde673b7cb5541e70da9193bb.zip |
Python test suite updates
Diffstat (limited to 'python/test/Ice/slicing/exceptions')
-rw-r--r-- | python/test/Ice/slicing/exceptions/AllTests.py | 4 | ||||
-rwxr-xr-x | python/test/Ice/slicing/exceptions/Client.py | 22 | ||||
-rwxr-xr-x | python/test/Ice/slicing/exceptions/Server.py | 36 | ||||
-rwxr-xr-x | python/test/Ice/slicing/exceptions/ServerAMD.py | 44 |
4 files changed, 47 insertions, 59 deletions
diff --git a/python/test/Ice/slicing/exceptions/AllTests.py b/python/test/Ice/slicing/exceptions/AllTests.py index eba36fc17cc..9dc2054c036 100644 --- a/python/test/Ice/slicing/exceptions/AllTests.py +++ b/python/test/Ice/slicing/exceptions/AllTests.py @@ -222,8 +222,8 @@ class RelayI(Test.Relay): ex.p2 = ex.p1 raise ex -def allTests(communicator): - obj = communicator.stringToProxy("Test:default -p 12010") +def allTests(helper, communicator): + obj = communicator.stringToProxy("Test:{0}".format(helper.getTestEndpoint())) t = Test.TestIntfPrx.checkedCast(obj) sys.stdout.write("base... ") diff --git a/python/test/Ice/slicing/exceptions/Client.py b/python/test/Ice/slicing/exceptions/Client.py index 6826dcd1889..cb8e7d513cd 100755 --- a/python/test/Ice/slicing/exceptions/Client.py +++ b/python/test/Ice/slicing/exceptions/Client.py @@ -8,20 +8,14 @@ # # ********************************************************************** -import os, sys, traceback +from TestHelper import TestHelper +TestHelper.loadSlice("Test.ice") +import AllTests -import Ice, AllTests -def run(args, communicator): - Test = AllTests.allTests(communicator) - Test.shutdown() - return True +class Client(TestHelper): -try: - with Ice.initialize(sys.argv) as communicator: - status = run(sys.argv, communicator) -except: - traceback.print_exc() - status = False - -sys.exit(not status) + def run(self, args): + with self.initialize(args=args) as communicator: + initial = AllTests.allTests(self, communicator) + initial.shutdown() diff --git a/python/test/Ice/slicing/exceptions/Server.py b/python/test/Ice/slicing/exceptions/Server.py index 4ade2ca8d9c..c29a5c86979 100755 --- a/python/test/Ice/slicing/exceptions/Server.py +++ b/python/test/Ice/slicing/exceptions/Server.py @@ -8,11 +8,12 @@ # # ********************************************************************** -import os, sys, traceback +from TestHelper import TestHelper +TestHelper.loadSlice("-I. --all ServerPrivate.ice") import Ice -Ice.loadSlice('-I. --all ServerPrivate.ice') import Test + class TestI(Test.TestIntf): def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() @@ -155,22 +156,15 @@ class TestI(Test.TestIntf): p = Test.RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())) p.unknownPreservedAsKnownPreserved() -def run(args, communicator): - properties = communicator.getProperties() - properties.setProperty("Ice.Warn.Dispatch", "0") - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000") - adapter = communicator.createObjectAdapter("TestAdapter") - object = TestI() - adapter.add(object, Ice.stringToIdentity("Test")) - adapter.activate() - communicator.waitForShutdown() - return True - -try: - with Ice.initialize(sys.argv) as communicator: - status = run(sys.argv, communicator) -except: - traceback.print_exc() - status = False - -sys.exit(not status) + +class Server(TestHelper): + def run(self, args): + properties = self.createTestProperties(args) + properties.setProperty("Ice.Warn.Dispatch", "0") + with self.initialize(properties=properties) as communicator: + communicator.getProperties().setProperty("TestAdapter.Endpoints", + "{0} -t 10000".format(self.getTestEndpoint())) + adapter = communicator.createObjectAdapter("TestAdapter") + adapter.add(TestI(), Ice.stringToIdentity("Test")) + adapter.activate() + communicator.waitForShutdown() diff --git a/python/test/Ice/slicing/exceptions/ServerAMD.py b/python/test/Ice/slicing/exceptions/ServerAMD.py index 73ab20b8eaa..f497895516d 100755 --- a/python/test/Ice/slicing/exceptions/ServerAMD.py +++ b/python/test/Ice/slicing/exceptions/ServerAMD.py @@ -8,13 +8,19 @@ # # ********************************************************************** -import os, sys, traceback - +from TestHelper import TestHelper +TestHelper.loadSlice("-I. --all ServerPrivate.ice") import Ice -Ice.loadSlice('-I. --all ServerPrivate.ice') import Test + +def test(b): + if not b: + raise RuntimeError('test assertion failed') + + class TestI(Test.TestIntf): + def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() @@ -216,22 +222,16 @@ class TestI(Test.TestIntf): f.set_exception(ex) return f -def run(args, communicator): - properties = communicator.getProperties() - properties.setProperty("Ice.Warn.Dispatch", "0") - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000") - adapter = communicator.createObjectAdapter("TestAdapter") - object = TestI() - adapter.add(object, Ice.stringToIdentity("Test")) - adapter.activate() - communicator.waitForShutdown() - return True - -try: - with Ice.initialize(sys.argv) as communicator: - status = run(sys.argv, communicator) -except: - traceback.print_exc() - status = False - -sys.exit(not status) + +class ServerAMD(TestHelper): + + def run(self, args): + properties = self.createTestProperties(args) + properties.setProperty("Ice.Warn.Dispatch", "0") + with self.initialize(properties=properties) as communicator: + communicator.getProperties().setProperty("TestAdapter.Endpoints", + "{0} -t 10000".format(self.getTestEndpoint())) + adapter = communicator.createObjectAdapter("TestAdapter") + adapter.add(TestI(), Ice.stringToIdentity("Test")) + adapter.activate() + communicator.waitForShutdown() |