From 41ffba6a76a80a7ef4553cb8856393dd209d172e Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Tue, 10 Mar 2020 17:37:16 +0100 Subject: First release of the test. All the tests work correctly for SOPA0000. --- test-cli/test/tests/qserial.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test-cli/test/tests/qserial.py') diff --git a/test-cli/test/tests/qserial.py b/test-cli/test/tests/qserial.py index 67e3af1..45c9d03 100644 --- a/test-cli/test/tests/qserial.py +++ b/test-cli/test/tests/qserial.py @@ -9,7 +9,7 @@ class Qserial(unittest.TestCase): __port = None __baudrate = None - #varlist: port, baudrate + # varlist: port, baudrate def __init__(self, testname, testfunc, varlist): self.params = varlist super(Qserial, self).__init__(testfunc) @@ -26,8 +26,6 @@ class Qserial(unittest.TestCase): # open serial connection self.__serial = serial.Serial(self.__port, self.__baudrate, timeout=1) - self.__serial.flushInput() - self.__serial.flushOutput() def __del__(self): self.__serial.close() @@ -35,6 +33,9 @@ class Qserial(unittest.TestCase): def execute(self): # generate a random uuid test_uuid = str(uuid.uuid4()).encode() + # clean serial port + self.__serial.flushInput() + self.__serial.flushOutput() # send the uuid through serial port self.__serial.write(test_uuid) time.sleep(0.05) # there might be a small delay @@ -44,4 +45,3 @@ class Qserial(unittest.TestCase): # check if what it was sent is equal to what has been received if self.__serial.readline() != test_uuid: self.fail("failed: port {} write/read mismatch".format(self.__port)) - -- cgit v1.1