diff options
author | Hector Fernandez <hector@iatec.biz> | 2020-06-25 11:45:31 +0200 |
---|---|---|
committer | Hector Fernandez <hector@iatec.biz> | 2020-06-25 11:45:31 +0200 |
commit | db3b1e45c47a1ef23c1ad67114a09cbec0976681 (patch) | |
tree | 6833ba2e59be77f9e818823068570ca3d51959cc /test-cli/test/tests/qduplex_ser.py | |
parent | 278b5729a44837e37fe13611518c1babc8de00df (diff) | |
download | board-db3b1e45c47a1ef23c1ad67114a09cbec0976681.zip board-db3b1e45c47a1ef23c1ad67114a09cbec0976681.tar.gz board-db3b1e45c47a1ef23c1ad67114a09cbec0976681.tar.bz2 |
Solved bugs. Adapted to DB changes.
Diffstat (limited to 'test-cli/test/tests/qduplex_ser.py')
-rw-r--r-- | test-cli/test/tests/qduplex_ser.py | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/test-cli/test/tests/qduplex_ser.py b/test-cli/test/tests/qduplex_ser.py index c7231c2..020844a 100644 --- a/test-cli/test/tests/qduplex_ser.py +++ b/test-cli/test/tests/qduplex_ser.py @@ -9,6 +9,7 @@ class Qduplex(unittest.TestCase): __port1 = None __port2 = None __baudrate = None + __resultlist = None # resultlist is a python list of python dictionaries # varlist: port1, port2, baudrate def __init__(self, testname, testfunc, varlist): @@ -27,6 +28,7 @@ class Qduplex(unittest.TestCase): else: raise Exception('baudrate param inside Qduplex must be defined') self._testMethodDoc = testname + self.__resultlist = [] # open serial connection self.__serial1 = serial.Serial(self.__port1, self.__baudrate, timeout=1) @@ -49,9 +51,23 @@ class Qduplex(unittest.TestCase): self.__serial1.write(test_uuid) time.sleep(0.05) # there might be a small delay if self.__serial2.inWaiting() == 0: + self.__resultlist.append( + { + "desc": "Test result", + "data": "FAILED: port {} wait timeout exceded".format(self.__port2), + "type": "string" + } + ) self.fail("failed: port {} wait timeout exceded".format(self.__port2)) else: if self.__serial2.readline() != test_uuid: + self.__resultlist.append( + { + "desc": "Test result", + "data": "FAILED: port {} write/read mismatch".format(self.__port2), + "type": "string" + } + ) self.fail("failed: port {} write/read mismatch".format(self.__port2)) time.sleep(0.05) # there might be a small delay @@ -65,12 +81,33 @@ class Qduplex(unittest.TestCase): self.__serial2.write(test_uuid) time.sleep(0.05) # there might be a small delay if self.__serial1.inWaiting() == 0: + self.__resultlist.append( + { + "desc": "Test result", + "data": "FAILED: port {} wait timeout exceded".format(self.__port1), + "type": "string" + } + ) self.fail("failed: port {} wait timeout exceded".format(self.__port1)) else: if self.__serial1.readline() != test_uuid: + self.__resultlist.append( + { + "desc": "Test result", + "data": "FAILED: port {} write/read mismatch".format(self.__port1), + "type": "string" + } + ) self.fail("failed: port {} write/read mismatch".format(self.__port1)) + # Test successful + self.__resultlist.append( + { + "desc": "Test OK", + "data": "OK", + "type": "string" + } + ) + def getresults(self): - # resultlist is a python list of python dictionaries - resultlist = [] - return resultlist + return self.__resultlist |