summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qamper.py
diff options
context:
space:
mode:
authorHector Fernandez <hector@iatec.biz>2020-06-17 09:44:56 +0200
committerHector Fernandez <hector@iatec.biz>2020-06-17 09:44:56 +0200
commit09b3bb38fc7305c9b47c29bc90ebc9c636827307 (patch)
treea793c8f232031183960178d2a18fcde4baf3348f /test-cli/test/tests/qamper.py
parent0dd2613b88d937e71b274d68924088b1bad65de4 (diff)
downloadboard-09b3bb38fc7305c9b47c29bc90ebc9c636827307.zip
board-09b3bb38fc7305c9b47c29bc90ebc9c636827307.tar.gz
board-09b3bb38fc7305c9b47c29bc90ebc9c636827307.tar.bz2
SOPA0000: Added support for saving results (strings or files) in the DB. It also saves a final DMESG file.
Diffstat (limited to 'test-cli/test/tests/qamper.py')
-rw-r--r--test-cli/test/tests/qamper.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/test-cli/test/tests/qamper.py b/test-cli/test/tests/qamper.py
index c611fdb..51aa469 100644
--- a/test-cli/test/tests/qamper.py
+++ b/test-cli/test/tests/qamper.py
@@ -4,6 +4,7 @@ from test.helpers.amper import Amper
class Qamper(unittest.TestCase):
params = None
+ __current = None
# varlist: undercurrent, overcurrent
def __init__(self, testname, testfunc, varlist):
@@ -33,12 +34,22 @@ class Qamper(unittest.TestCase):
self.fail("failed: can not communicate")
return
# get current value (in Amperes)
- result = amp.getCurrent()
+ self.__current = amp.getCurrent()
# close serial connection
amp.close()
- # # In order to give a valid result it is importarnt to define an under current value
- if result > float(self._overcurrent):
- self.fail("failed: Overcurrent detected ( {} )".format(result))
+ # Check current range
+ if float(self.__current) > float(self._overcurrent):
+ self.fail("failed: Overcurrent detected ( {} )".format(self.__current))
+ if float(self.__current) < float(self._undercurrent):
+ self.fail("failed: Undercurrent detected ( {} )".format(self.__current))
- if result < float(self._undercurrent):
- self.fail("failed: Undercurrent detected ( {} )".format(result))
+ def getresults(self):
+ # resultlist is a python list of python dictionaries
+ resultlist = [
+ {
+ "desc": "current (Ampers)",
+ "data": self.__current,
+ "type": "string"
+ }
+ ]
+ return resultlist