This commit is contained in:
boccioli_m
2015-08-04 13:40:36 +02:00
parent b22d72d2c3
commit da9e10fc7e
10 changed files with 567 additions and 483 deletions
@@ -1,7 +1,27 @@
###### DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect
import sys, inspect, os, traceback
def print_log(testName, DEVICE, text):
time.ctime()
now = time.strftime('%Y.%m.%d %H:%M:%S')
print now + ' ' + DEVICE + ' - ' + testName + ': ' + text
#prepare and send feedback to calling tool
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
print_log(testName, DEVICE, 'End of test. Result:')
print_log(testName, DEVICE, 'Device: ' + DEVICE)
print_log(testName, DEVICE, 'Test name: ' + testName)
print_log(testName, DEVICE, 'Test path: ' + testPath)
print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
print_log(testName, DEVICE, 'Return string: ' + returnString)
ret = [testPath, DEVICE, returnString, testPassed]
set_return(ret)
def startTest(testName, DEVICE, params):
#get the path of this script
import inspect
testPath = inspect.getfile(inspect.currentframe())
#by default, failed
ret = 'Test failed'
@@ -9,10 +29,11 @@ def startTest(testName, DEVICE, params):
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
###### WRITE YOUR CODE HERE BELOW #######
print_log(testName, DEVICE, 'testpath A: ' + testPath )
print_log(testName, DEVICE, 'parameters: ' + str(params) )
print_log(testName, DEVICE, 'testpath A: ' + testPath )
print_log(testName, DEVICE, 'parameters: ' + str(params) )
print_log(testName, DEVICE, 'device: ' + DEVICE )
scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'] , [0.0], [30.0], [20])
#scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'] , [0.0], [30.0], [20])
scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'])
scan.setPlotName(plotName)
scan.start()
@@ -32,6 +53,7 @@ def startTest(testName, DEVICE, params):
ActualI = Channel(DEVICE + ':Actual-IA', type = 'd')
#ActualI = Channel('pw84:ai', type = 'd')
except:
import traceback
sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
#raise Exception('Unable to create channel - ' + traceback.format_exc())
return
@@ -85,32 +107,12 @@ def startTest(testName, DEVICE, params):
ActualI.close()
scan.end()
########## END OF YOUR CODE ###########
############# END OF YOUR CODE ###########
###### DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, status)
#prepare and send feedback to calling tool
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
print_log(testName, DEVICE, 'End of test. Result:')
print_log(testName, DEVICE, 'Test path: ' + testPath)
print_log(testName, DEVICE, 'Test name: ' + testName )
print_log(testName, DEVICE, 'Device: ' + DEVICE)
print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
print_log(testName, DEVICE, 'Return string: ' + returnString)
ret = [testPath, DEVICE, returnString, testPassed]
set_return(ret)
def print_log(testName, DEVICE, text):
time.ctime()
now = time.strftime('%Y.%m.%d %H:%M:%S')
print now + ' ' + DEVICE + ' - ' + testName + ': ' + text
import sys, inspect, os, traceback
#get test arguments
DEVICE = device
testName = test
params = parameters
#launch the test
startTest(testName, DEVICE, params)
parameters = {}
startTest(test, device, parameters)
@@ -1,18 +1,39 @@
###### DO NOT MODIFY THE CODE BELOW ######
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect
import sys, inspect, os, traceback
def print_log(testName, DEVICE, text):
time.ctime()
now = time.strftime('%Y.%m.%d %H:%M:%S')
print now + ' ' + DEVICE + ' - ' + testName + ': ' + text
#prepare and send feedback to calling tool
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
print_log(testName, DEVICE, 'End of test. Result:')
print_log(testName, DEVICE, 'Device: ' + DEVICE)
print_log(testName, DEVICE, 'Test name: ' + testName)
print_log(testName, DEVICE, 'Test path: ' + testPath)
print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
print_log(testName, DEVICE, 'Return string: ' + returnString)
ret = [testPath, DEVICE, returnString, testPassed]
set_return(ret)
def startTest(testName, DEVICE, params):
#get the path of this script
import inspect
testPath = inspect.getfile(inspect.currentframe())
#by default, failed
ret = 'Test failed'
status = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
###### WRITE YOUR CODE HERE BELOW #######
plotName = DEVICE + ' - ' + testName
######### WRITE YOUR CODE HERE BELOW #############
print_log(testName, DEVICE, 'testpath B: ' + testPath )
print_log(testName, DEVICE, 'parameters:' + str( params) )
print_log(testName, DEVICE, device: ' + DEVICE )
scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] , [0.0], [30.0], [20])
print_log(testName, DEVICE, 'device: ' + DEVICE )
#scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] , [0.0], [30.0], [20])
scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] )
scan.setPlotName(plotName)
scan.start()
@@ -33,7 +54,6 @@ def startTest(testName, DEVICE, params):
#ActualIA = Channel('pw84:ai', type = 'd')
except:
sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
#raise Exception('Unable to create channel - ' + traceback.format_exc())
return
#Init
SetRamp.put(10.0, timeout=None)
@@ -82,31 +102,11 @@ def startTest(testName, DEVICE, params):
SetVA.close()
ActualVA.close()
ActualIA.close()
########## END OF YOUR CODE ###########
###### DO NOT MODIFY THE CODE BELOW ######
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, status)
#prepare and send feedback to calling tool
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
print_log(testName, DEVICE, 'End of test. Result:')
print_log(testName, DEVICE, 'Test path: ' + testPath)
print_log(testName, DEVICE, 'Test name: ' + testName )
print_log(testName, DEVICE, 'Device: ' + DEVICE)
print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
print_log(testName, DEVICE, 'Return string: ' + returnString)
ret = [testPath, DEVICE, returnString, testPassed]
set_return(ret)
def print_log(testName, DEVICE, text):
time.ctime()
now = time.strftime('%Y.%m.%d %H:%M:%S')
print now + ' ' + DEVICE + ' - ' + testName + ': ' + text
import sys, inspect, os, traceback
#get test arguments
DEVICE = device
testName = test
params = parameters
#launch the test
startTest(testName, DEVICE, params)
parameters = {}
startTest(test, device, parameters)