From 77355baca0f628f5e95cbf1d8bf3c2475a95150f Mon Sep 17 00:00:00 2001 From: Manel Caro Date: Fri, 29 Mar 2019 14:54:24 +0100 Subject: Modify database connection object and xml parser object --- test-cli/test_main.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'test-cli/test_main.py') diff --git a/test-cli/test_main.py b/test-cli/test_main.py index 3c4d1cb..b3433bc 100644 --- a/test-cli/test_main.py +++ b/test-cli/test_main.py @@ -1,12 +1,13 @@ from test.helpers.get_dieid import genDieid -from subprocess import call import xml.etree.ElementTree as XMLParser import errno import sys import os import unittest from test.helpers.testsrv_db import TestSrv_Database +from test.helpers.testsrv_db import testServerDb from test.runners.simple import SimpleTestRunner +from test.helpers.setup_xml import XMLSetup from test.tests.qbutton import Qbutton from test.helpers.syscmd import TestSysCommand from test.helpers.syscmd import SysCommand @@ -27,10 +28,19 @@ from test.tests.qflash import Qflasher from test.helpers.finisher import Finisher from test.helpers.globalVariables import globalVar +# Database global object +pgdbcli = testServerDb() +# Configuration file amd Parse it +xmlsetup = XMLSetup("setup.xml") + # 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') + if os.name == 'posix': + os.system('clear') + else: + os.system('cls') def create_board(): @@ -99,6 +109,13 @@ def finish_test(): psdb.open("setup.xml") psdb.update_set_test_row(globalVar.station, globalVar.testid_ctl, globalVar.g_uuid, "END","FINISH") + +def dbconnection(): + if pgdbcli.open(xmlsetup) is False: + sys.exit("Database connection error") + print("value:", xmlsetup.getBoard('model', 'none')) + + def main(): #addtesttomodel() #addtestdef() @@ -114,5 +131,9 @@ def main(): if __name__ == "__main__": + # Clear python console clear() - main() + # database connection + dbconnection() + # Execute main + # main() -- cgit v1.1