summaryrefslogtreecommitdiff
path: root/test-cli/test/tests
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test/tests')
-rw-r--r--test-cli/test/tests/qamp.py1
-rw-r--r--test-cli/test/tests/qamper.py51
2 files changed, 52 insertions, 0 deletions
diff --git a/test-cli/test/tests/qamp.py b/test-cli/test/tests/qamp.py
index cf18fc5..56511c8 100644
--- a/test-cli/test/tests/qamp.py
+++ b/test-cli/test/tests/qamp.py
@@ -36,6 +36,7 @@ class Qamp(unittest.TestCase):
self._ser.close()
def execute(self):
+
# Open Serial port ttyUSB0
error = 0
try:
diff --git a/test-cli/test/tests/qamper.py b/test-cli/test/tests/qamper.py
new file mode 100644
index 0000000..2b02302
--- /dev/null
+++ b/test-cli/test/tests/qamper.py
@@ -0,0 +1,51 @@
+import unittest
+from test.helpers.amper import Amper
+
+
+class Qamper(unittest.TestCase):
+ params = None
+
+ # varlist: undercurrent, overcurrent
+ def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
+ super(Qamper, self).__init__(testfunc)
+
+ if "undercurrent" in varlist:
+ self._undercurrent = varlist["undercurrent"]
+ else:
+ raise Exception('undercurrent param inside Qamp must be defined')
+ if "overcurrent" in varlist:
+ self._overcurrent = varlist["overcurrent"]
+ else:
+ raise Exception('overcurrent param inside Qamp must be defined')
+ self._testMethodDoc = testname
+
+ def execute(self):
+ amp = Amper()
+ print(amp)
+ if not amp.open():
+ print("1")
+ self.fail("failed: can not open serial port")
+ return
+
+ if not amp.hello():
+ print("2")
+ self.fail("failed: can not communicate")
+ return
+
+ result = amp.getCurrent()
+ print(result)
+
+ amp.close()
+
+
+
+
+
+
+ # # 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))