summaryrefslogtreecommitdiff
path: root/test-cli/test/runners/simple.py
diff options
context:
space:
mode:
authorManel Caro <mcaro@iseebcn.com>2020-03-04 17:46:36 +0100
committerManel Caro <mcaro@iseebcn.com>2020-03-04 17:46:36 +0100
commit09de774dcc1a5abc1c8f3a00fdb039aa3c522f52 (patch)
treec4bd3963d0df01d2e3a33732247388ed4651b186 /test-cli/test/runners/simple.py
parentb6932fbaf898724ae87c29f8965621610f377084 (diff)
downloadboard-09de774dcc1a5abc1c8f3a00fdb039aa3c522f52.zip
board-09de774dcc1a5abc1c8f3a00fdb039aa3c522f52.tar.gz
board-09de774dcc1a5abc1c8f3a00fdb039aa3c522f52.tar.bz2
SOPA Initial Commit
Diffstat (limited to 'test-cli/test/runners/simple.py')
-rw-r--r--test-cli/test/runners/simple.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/test-cli/test/runners/simple.py b/test-cli/test/runners/simple.py
index 5b2da5a..3537d0e 100644
--- a/test-cli/test/runners/simple.py
+++ b/test-cli/test/runners/simple.py
@@ -22,9 +22,12 @@ class SimpleTestRunner:
---------------------------------------------
"""
- def __init__(self, stream=sys.stderr, verbosity=0):
+ __pgObj = None
+
+ def __init__(self, pgObj, stream=sys.stderr, verbosity=0):
self.stream = stream
self.verbosity = verbosity
+ self.__pgObj = pgObj
def writeUpdate(self, message):
self.stream.write(message)
@@ -33,7 +36,7 @@ class SimpleTestRunner:
""" Run the given test case or Test Suite.
"""
- result = TextTestResult(self)
+ result = TextTestResult(self, self.__pgObj)
test(result)
result.testsRun
# self.writeUpdate("---------------------------------------------\n")
@@ -45,18 +48,22 @@ class TextTestResult(unittest.TestResult):
FAIL = '\033[31mFAIL\033[0m\n'
ERROR = '\033[31mERROR\033[0m\n'
- def __init__(self, runner):
+ __pgObj = None
+
+ def __init__(self, runner, pgObj):
unittest.TestResult.__init__(self)
self.runner = runner
self.result = self.ERROR
+ self.__pgObj = pgObj
def startTest(self, test):
unittest.TestResult.startTest(self, test)
self.runner.writeUpdate("%s : " % test.shortDescription())
# SEND TO DB THE UPDATE THAT WE RUN EACH TEST
- psdb = TestSrv_Database()
- psdb.open("setup.xml")
- psdb.update_set_test_row(globalVar.station, globalVar.testid_ctl, globalVar.g_uuid, test.shortDescription(), "RUNNING")
+ self.__pgObj.update_set_test_row(globalVar.station, globalVar.testid_ctl, globalVar.g_uuid, test.shortDescription(), "RUNNING")
+ # psdb = TestSrv_Database()
+ # psdb.open("setup.xml")
+ # psdb.update_set_test_row(globalVar.station, globalVar.testid_ctl, globalVar.g_uuid, test.shortDescription(), "RUNNING")
def addSuccess(self, test):
unittest.TestResult.addSuccess(self, test)
@@ -93,6 +100,7 @@ class TextTestResult(unittest.TestResult):
if self.result == self.FAIL: simple_result = "FALSE"
elif self.result == self.ERROR: simple_result = "FALSE"
#SEND TO DB THE RESULT OF THE TEST
- psdb = TestSrv_Database()
- psdb.open("setup.xml")
- psdb.add_test_to_batch(globalVar.g_uuid, test.shortDescription(), globalVar.testid_ctl, simple_result, globalVar.g_mid, test.longMessage)
+ # psdb = TestSrv_Database()
+ # psdb.open("setup.xml")
+ self.__pgObj.add_test_to_batch(globalVar.g_uuid, test.shortDescription(), globalVar.testid_ctl, simple_result, globalVar.g_mid, test.longMessage)
+ # psdb.add_test_to_batch(globalVar.g_uuid, test.shortDescription(), globalVar.testid_ctl, simple_result, globalVar.g_mid, test.longMessage)