summaryrefslogtreecommitdiff
path: root/test-cli/test_main.py
diff options
context:
space:
mode:
authorManel Caro <mcaro@iseebcn.com>2019-03-29 14:54:24 +0100
committerManel Caro <mcaro@iseebcn.com>2019-03-29 14:54:24 +0100
commit77355baca0f628f5e95cbf1d8bf3c2475a95150f (patch)
treeed31cbe8ddc54b09ec471db0e033b33a9073748b /test-cli/test_main.py
parentb44174ae3decc9f9498541ce9aeed84ce183a9eb (diff)
downloadboard-77355baca0f628f5e95cbf1d8bf3c2475a95150f.zip
board-77355baca0f628f5e95cbf1d8bf3c2475a95150f.tar.gz
board-77355baca0f628f5e95cbf1d8bf3c2475a95150f.tar.bz2
Modify database connection object and xml parser object
Diffstat (limited to 'test-cli/test_main.py')
-rw-r--r--test-cli/test_main.py27
1 files changed, 24 insertions, 3 deletions
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()