summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qamper.py
diff options
context:
space:
mode:
authorHector Fernandez <hector@iatec.biz>2020-03-09 12:39:50 +0100
committerHector Fernandez <hector@iatec.biz>2020-03-09 12:39:50 +0100
commitc685367cbd6abf1c6ae442df759e39b25a907d3b (patch)
tree37a942f44512c7b567447de41b1ff2c8496898be /test-cli/test/tests/qamper.py
parenta03055f657d2e970e45e7ea2a3e66857f821eabd (diff)
downloadboard-c685367cbd6abf1c6ae442df759e39b25a907d3b.zip
board-c685367cbd6abf1c6ae442df759e39b25a907d3b.tar.gz
board-c685367cbd6abf1c6ae442df759e39b25a907d3b.tar.bz2
Fixed several test procedures.
Diffstat (limited to 'test-cli/test/tests/qamper.py')
-rw-r--r--test-cli/test/tests/qamper.py27
1 files changed, 9 insertions, 18 deletions
diff --git a/test-cli/test/tests/qamper.py b/test-cli/test/tests/qamper.py
index 2b02302..b3ab8b1 100644
--- a/test-cli/test/tests/qamper.py
+++ b/test-cli/test/tests/qamper.py
@@ -22,30 +22,21 @@ class Qamper(unittest.TestCase):
def execute(self):
amp = Amper()
- print(amp)
+ # open serial connection
if not amp.open():
- print("1")
self.fail("failed: can not open serial port")
return
-
+ # check if the amperimeter is connected and working
if not amp.hello():
- print("2")
self.fail("failed: can not communicate")
return
-
+ # get current value (in Amperes)
result = amp.getCurrent()
- print(result)
-
+ # 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))
-
-
-
-
-
- # # In order to give a valid result it is importarnt to define an under current value
- # if self._current > float(self._overcurrent):
- # self.fail("failed: OVERCURRENT DETECTED ( {} )".format(self._current))
- #
- # if 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))