From c2c5cec25527227d9da83a32cc522119a033e344 Mon Sep 17 00:00:00 2001 From: boccioli_m Date: Wed, 2 Sep 2015 10:25:35 +0200 Subject: [PATCH] Closedown --- script/testcommons.py | 41 ++++++++++--------- .../PS Tests/power-supply-A/power-supply-A.py | 2 + 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/script/testcommons.py b/script/testcommons.py index 4a8d741..ba8f115 100644 --- a/script/testcommons.py +++ b/script/testcommons.py @@ -1,24 +1,27 @@ global print_log, sendFeedback, sys, inspect, os, traceback import sys, inspect, os, traceback -def print_log(testName, DEVICE, text): - import time - time.ctime() - now = time.strftime('%Y.%m.%d %H:%M:%S') - print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(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] - return ret +class TestingTool: -pippo = 'pippo' + pippo = 'pippo' + def print_log(self, testName, DEVICE, text): + import time + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) + + #prepare and send feedback to calling tool + def sendFeedback(self, 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] + return ret -def print_pio(): - print 'piopio' \ No newline at end of file + + + def print_pio(self): + print 'piopio' \ No newline at end of file diff --git a/script/tests/tests/PS Tests/power-supply-A/power-supply-A.py b/script/tests/tests/PS Tests/power-supply-A/power-supply-A.py index 503fc2d..b02afe2 100644 --- a/script/tests/tests/PS Tests/power-supply-A/power-supply-A.py +++ b/script/tests/tests/PS Tests/power-supply-A/power-supply-A.py @@ -13,6 +13,8 @@ def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): def startTest(testName, DEVICE, params): #get the path of this script + testTool = testcommons.TestingTool() + testTool.print_pio testcommons.print_pio() import inspect testPath = inspect.getfile(inspect.currentframe())