summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qamper.py
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test/tests/qamper.py')
-rw-r--r--test-cli/test/tests/qamper.py51
1 files changed, 51 insertions, 0 deletions
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))