summaryrefslogtreecommitdiff
path: root/test-cli/test_main.py
diff options
context:
space:
mode:
authorHector Fernandez <hector@iatec.biz>2020-03-05 16:29:31 +0100
committerHector Fernandez <hector@iatec.biz>2020-03-05 16:29:31 +0100
commita615dac03a9ea7897bf3947ba8d31278b2cea121 (patch)
tree2112572fc48cf74bac76a7db69005ae1373ed0db /test-cli/test_main.py
parent23e0cea58ba6ac5357db507b0ac7f8dfcf223326 (diff)
downloadboard-a615dac03a9ea7897bf3947ba8d31278b2cea121.zip
board-a615dac03a9ea7897bf3947ba8d31278b2cea121.tar.gz
board-a615dac03a9ea7897bf3947ba8d31278b2cea121.tar.bz2
Modify tests.
Diffstat (limited to 'test-cli/test_main.py')
-rw-r--r--test-cli/test_main.py30
1 files changed, 13 insertions, 17 deletions
diff --git a/test-cli/test_main.py b/test-cli/test_main.py
index 6680082..b657f00 100644
--- a/test-cli/test_main.py
+++ b/test-cli/test_main.py
@@ -32,15 +32,15 @@ import re
from test.helpers.iseelogger import ISEE_Logger
import logging
-
psdbObj = TestSrv_Database()
xmlObj = None
loggerObj = None
+
# define clear function
def clear():
# check and make call for specific operating system
- _ = call('clear' if os.name =='posix' else 'cls')
+ _ = call('clear' if os.name == 'posix' else 'cls')
def create_board():
@@ -48,25 +48,21 @@ def create_board():
variant = xmlObj.gettagKey('board', 'variant')
# get model id
- globalVar.g_mid=model_id + "-" + variant
+ globalVar.g_mid = model_id + "-" + variant
- # get station number
- hstname = socket.gethostname()
- if (re.search("^Station\d{2}$", hstname)):
- globalVar.station = int(re.search("\d{2}", hstname).group(0))
- else:
- raise Exception('Station number not configured')
- exit(3)
+ # get station
+ globalVar.station = socket.gethostname()
processor_id = genDieid(globalVar.g_mid)
print(globalVar.g_mid)
print(processor_id)
- globalVar.g_uuid = psdbObj.create_board(processor_id, model_id, variant, bmac = None)
+ globalVar.g_uuid = psdbObj.create_board(processor_id, model_id, variant, bmac=None)
+
def createvarlist(testvars):
varlist = {}
for row in testvars:
- varname,testparam = row
+ varname, testparam = row
varlist[varname] = testparam
return varlist
@@ -75,13 +71,13 @@ def testsuite():
suite = unittest.TestSuite()
tests = psdbObj.getboard_comp_test_list(globalVar.g_uuid)
for row in tests:
- testdefname,testfunc = row
+ testdefname, testfunc = row
testvars = psdbObj.getboard_test_variables(globalVar.g_uuid, testdefname)
varlist = createvarlist(testvars)
command = "suite.addTest({}('{}','execute', varlist))".format(testfunc, testdefname)
exec(command)
-
- globalVar.testid_ctl=psdbObj.open_testbatch(globalVar.g_uuid, globalVar.station)
+
+ globalVar.testid_ctl = psdbObj.open_testbatch(globalVar.g_uuid, globalVar.station)
return suite
@@ -90,6 +86,7 @@ def finish_test():
# Update Set Test status with FINISH so that status column is not modified because close_testbatch already did it.
psdbObj.update_set_test_row(globalVar.station, globalVar.testid_ctl, globalVar.g_uuid, 'END', 'FINISH')
+
def main():
create_board()
try:
@@ -120,6 +117,5 @@ if __name__ == "__main__":
if psdbObj.open(xmlObj):
main()
else:
- print("Error: Cannot open DB connection")
+ print("Error: Cannot open DB connection")
exit(2)
-