Update sics_test.py to add position_names and embedded python tests
This commit is contained in:
@ -481,7 +481,86 @@ class Baker(Able):
|
||||
for line in text:
|
||||
print line
|
||||
|
||||
class Charlie(Able):
|
||||
timeout = 5
|
||||
def test_000_000_posit(self):
|
||||
debug = True
|
||||
def cb(result, *args, **kw):
|
||||
if debug:
|
||||
print "\nposit:", result, args, kw
|
||||
phase = args[0]
|
||||
target = 1
|
||||
if phase == target:
|
||||
d = self.send_command("m1 positions 10 20 30")
|
||||
d.addCallback(cb, phase + 1)
|
||||
return
|
||||
target += 1
|
||||
if phase == target:
|
||||
d = self.send_command("m1 position_names One Two Three")
|
||||
d.addCallback(cb, phase + 1)
|
||||
return
|
||||
target += 1
|
||||
if phase == target:
|
||||
d = self.send_command("m1 position_names")
|
||||
d.addCallback(cb, phase + 1)
|
||||
return
|
||||
target += 1
|
||||
if phase == target:
|
||||
d = self.send_command("m1 softzero")
|
||||
d.addCallback(cb, phase + 1)
|
||||
return
|
||||
target += 1
|
||||
if phase == target:
|
||||
d = self.send_command("m1 posit2hard three")
|
||||
d.addCallback(cb, phase + 1)
|
||||
return
|
||||
target += 1
|
||||
if phase == target:
|
||||
d = self.send_command("m1 posit2soft three")
|
||||
d.addCallback(cb, phase + 1)
|
||||
return
|
||||
|
||||
self.deferred.callback(True)
|
||||
self.deferred = defer.Deferred();
|
||||
d = self.send_command("m1 positions erase")
|
||||
d.addCallback(cb, 1)
|
||||
return self.deferred
|
||||
|
||||
def test_001_000_python(self):
|
||||
debug = True
|
||||
def cb(result, *args, **kw):
|
||||
if debug:
|
||||
print "\npython:", result, args, kw
|
||||
phase = args[0]
|
||||
target = 0
|
||||
target += 1
|
||||
if phase == target:
|
||||
if result[0].startswith("python=obj, type=python,"):
|
||||
d = self.send_command("python sics.puts(\"Hello Sailor\")")
|
||||
d.addCallback(cb, phase + 1)
|
||||
else:
|
||||
raise unittest.SkipTest("Python is not configured")
|
||||
return
|
||||
|
||||
target += 1
|
||||
if phase == target:
|
||||
if result[0].startswith("Hello Sailor"):
|
||||
d = self.send_command("python sics.puts(sics.sics(\"clientput Hello World\"))")
|
||||
d.addCallback(cb, phase + 1)
|
||||
return
|
||||
|
||||
target += 1
|
||||
if phase == target:
|
||||
self.assertTrue(result[0].startswith("Hello World"))
|
||||
|
||||
self.deferred.callback(True)
|
||||
self.deferred = defer.Deferred();
|
||||
d = self.send_command("sicslist python")
|
||||
d.addCallback(cb, 1)
|
||||
return self.deferred
|
||||
|
||||
class Zulu(Able):
|
||||
timeout = 5
|
||||
def test_performance(self):
|
||||
d = self.send_command("performance")
|
||||
def cb3(result, *args, **kw):
|
||||
|
Reference in New Issue
Block a user