summaryrefslogtreecommitdiff
path: root/python/test/Slice/escape/Client.py
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2018-08-06 11:56:42 +0200
committerJose <jose@zeroc.com>2018-08-06 11:56:42 +0200
commit7972f07a3aa244dcde673b7cb5541e70da9193bb (patch)
tree117faced1bb36ac256c7d362e11ac1c49e8e8c88 /python/test/Slice/escape/Client.py
parentUpdate JavaScript tests to use TestHelper class (diff)
downloadice-7972f07a3aa244dcde673b7cb5541e70da9193bb.tar.bz2
ice-7972f07a3aa244dcde673b7cb5541e70da9193bb.tar.xz
ice-7972f07a3aa244dcde673b7cb5541e70da9193bb.zip
Python test suite updates
Diffstat (limited to 'python/test/Slice/escape/Client.py')
-rwxr-xr-xpython/test/Slice/escape/Client.py78
1 files changed, 33 insertions, 45 deletions
diff --git a/python/test/Slice/escape/Client.py b/python/test/Slice/escape/Client.py
index 33a4ac5cbee..915030fbe25 100755
--- a/python/test/Slice/escape/Client.py
+++ b/python/test/Slice/escape/Client.py
@@ -8,42 +8,39 @@
#
# **********************************************************************
-import os, sys, traceback
-
-for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
- toplevel = os.path.normpath(toplevel)
- if os.path.exists(os.path.join(toplevel, "python", "Ice", "__init__.py")):
- break
-else:
- raise RuntimeError("can't find toplevel directory!")
-
+from TestHelper import TestHelper
+TestHelper.loadSlice("Key.ice Clash.ice")
+import sys
import Ice
-
-Ice.loadSlice('Key.ice')
-Ice.loadSlice('Clash.ice')
-
import _and
+
class delI(_and._del):
def _elifAsync(self, _else, current=None):
pass
+
class execI(_and._exec):
def _finally(self, current=None):
assert current.operation == "finally"
+
class ifI(_and._if):
def _elifAsync(self, _else, current=None):
pass
+
def _finally(self, current=None):
pass
+
def foo(self, _from, current=None):
pass
+
class printI(_and._print):
def _raise(self, _else, _return, _try, _while, _yield, _lambda, _or, _global):
pass
+
def testtypes():
sys.stdout.write("Testing generated type names... ")
sys.stdout.flush()
@@ -74,36 +71,27 @@ def testtypes():
en = _and.EnumNone._None
print("ok")
-def run(args, communicator):
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010")
- adapter = communicator.createObjectAdapter("TestAdapter")
- adapter.add(execI(), Ice.stringToIdentity("test"))
- adapter.activate()
-
- sys.stdout.write("Testing operation name... ")
- sys.stdout.flush()
- p = _and.execPrx.uncheckedCast(
- adapter.createProxy(Ice.stringToIdentity("test")));
- p._finally();
- print("ok")
- testtypes()
-
- return True
-
-try:
- initData = Ice.InitializationData()
- initData.properties = Ice.createProperties(sys.argv)
- #
- # Its possible to have batch oneway requests dispatched after the
- # adapter is deactivated due to thread scheduling so we supress
- # this warning.
- #
- 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
-
-sys.exit(not status)
+class Client(TestHelper):
+
+ 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")
+ with self.initialize(properties=properties) as communicator:
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint())
+ adapter = communicator.createObjectAdapter("TestAdapter")
+ adapter.add(execI(), Ice.stringToIdentity("test"))
+ adapter.activate()
+
+ sys.stdout.write("Testing operation name... ")
+ sys.stdout.flush()
+ p = _and.execPrx.uncheckedCast(adapter.createProxy(Ice.stringToIdentity("test")))
+ p._finally()
+ print("ok")
+
+ testtypes()