diff options
Diffstat (limited to 'python/test/Ice/operations/ServerAMD.py')
-rwxr-xr-x | python/test/Ice/operations/ServerAMD.py | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/python/test/Ice/operations/ServerAMD.py b/python/test/Ice/operations/ServerAMD.py index 0fb5b35becf..00fff796d5c 100755 --- a/python/test/Ice/operations/ServerAMD.py +++ b/python/test/Ice/operations/ServerAMD.py @@ -8,42 +8,37 @@ # # ********************************************************************** -import os, sys, traceback, threading, time - +import sys # -# We want to test coroutines but older versions of Python cannot load a source file that uses the -# async/await keywords, so we have two versions of MyDerivedClassI. +# We want to test coroutines but older versions of Python cannot +# load a source file that uses the async/await keywords, so we +# have two versions of MyDerivedClassI. # -if sys.version_info >= (3,5): +if sys.version_info >= (3, 5): from TestAMDCoroI import MyDerivedClassI else: from TestAMDI import MyDerivedClassI + +from TestHelper import TestHelper +TestHelper.loadSlice("Test.ice") import Ice -slice_dir = Ice.getSliceDir() -if not slice_dir: - print(sys.argv[0] + ': Slice directory not found.') - sys.exit(1) -Ice.loadSlice("'-I" + slice_dir + "' Test.ice") -import Test -def run(args, communicator): - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010") - adapter = communicator.createObjectAdapter("TestAdapter") - adapter.add(MyDerivedClassI(), Ice.stringToIdentity("test")) - adapter.activate() - communicator.waitForShutdown() - return True +class ServerAMD(TestHelper): -try: - initData = Ice.InitializationData() - initData.properties = Ice.createProperties(sys.argv) - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - with Ice.initialize(sys.argv, initData) as communicator: - status = run(sys.argv, communicator) -except: - traceback.print_exc() - status = False + def run(self, args): + properties = self.createTestProperties(args) + # + # Its possible to have batch oneway requests dispatched after the + # adapter is deactivated due to thread scheduling so we supress + # this warning. + # + properties.setProperty("Ice.Warn.Dispatch", "0") -sys.exit(not status) + with self.initialize(properties=properties) as communicator: + communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + adapter = communicator.createObjectAdapter("TestAdapter") + adapter.add(MyDerivedClassI(), Ice.stringToIdentity("test")) + adapter.activate() + communicator.waitForShutdown() |