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/custom/Server.py | |
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/custom/Server.py')
-rwxr-xr-x | python/test/Ice/custom/Server.py | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/python/test/Ice/custom/Server.py b/python/test/Ice/custom/Server.py index 7716cb78b0f..a917feb2a8c 100755 --- a/python/test/Ice/custom/Server.py +++ b/python/test/Ice/custom/Server.py @@ -8,16 +8,18 @@ # # ********************************************************************** -import os, sys, traceback - -import Ice -Ice.loadSlice('Test.ice') +from TestHelper import TestHelper +TestHelper.loadSlice("Test.ice") +import sys import Test +import Ice + def test(b): if not b: raise RuntimeError('test assertion failed') + class CustomI(Test.Custom): def opByteString1(self, b1, current=None): if sys.version_info[0] == 2: @@ -89,20 +91,13 @@ class CustomI(Test.Custom): def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() -def run(args, communicator): - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010") - adapter = communicator.createObjectAdapter("TestAdapter") - object = CustomI() - 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): + with self.initialize(args=args) as communicator: + communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + adapter = communicator.createObjectAdapter("TestAdapter") + adapter.add(CustomI(), Ice.stringToIdentity("test")) + adapter.activate() + communicator.waitForShutdown() |