From db3b1e45c47a1ef23c1ad67114a09cbec0976681 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Thu, 25 Jun 2020 11:45:31 +0200 Subject: Solved bugs. Adapted to DB changes. --- test-cli/test/tests/qi2c.py | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'test-cli/test/tests/qi2c.py') diff --git a/test-cli/test/tests/qi2c.py b/test-cli/test/tests/qi2c.py index ad7ddf0..3afedfa 100644 --- a/test-cli/test/tests/qi2c.py +++ b/test-cli/test/tests/qi2c.py @@ -4,6 +4,7 @@ import unittest class Qi2c(unittest.TestCase): params = None + __resultlist = None # resultlist is a python list of python dictionaries def __init__(self, testname, testfunc, varlist): self.params = varlist @@ -18,6 +19,7 @@ class Qi2c(unittest.TestCase): raise Exception('register param inside Qi2c must be defined') self.__devices = [] self._testMethodDoc = testname + self.__resultlist = [] def execute(self): str_cmd = "i2cdetect -a -y -r {}".format(self.__busnum) @@ -34,11 +36,32 @@ class Qi2c(unittest.TestCase): "0x{}{}".format((i - 1), hex(int((lines[i].find("UU") - 4) / 3)).split('x')[-1])) for i in range(len(self.__register)): if not (self.__register[i] in self.__devices): + self.__resultlist.append( + { + "desc": "Test result", + "data": "FAILED: device {} not found in bus i2c-{}".format(self.__register[i], self.__busnum), + "type": "string" + } + ) self.fail("failed: device {} not found in bus i2c-{}".format(self.__register[i], self.__busnum)) else: - self.fail("failed: could not complete i2cdedtect command") + self.__resultlist.append( + { + "desc": "Test result", + "data": "FAILED: could not complete i2cdedtect command", + "type": "string" + } + ) + self.fail("failed: could not complete i2cdedtect command.") + + # Test successful + self.__resultlist.append( + { + "desc": "Test result", + "data": "OK", + "type": "string" + } + ) def getresults(self): - # resultlist is a python list of python dictionaries - resultlist = [] - return resultlist + return self.__resultlist -- cgit v1.1