summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qduplex_ser.py
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test/tests/qduplex_ser.py')
-rw-r--r--test-cli/test/tests/qduplex_ser.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/test-cli/test/tests/qduplex_ser.py b/test-cli/test/tests/qduplex_ser.py
index 0666363..cb690cb 100644
--- a/test-cli/test/tests/qduplex_ser.py
+++ b/test-cli/test/tests/qduplex_ser.py
@@ -30,11 +30,7 @@ class Qduplex(unittest.TestCase):
# open serial connection
self.__serial1 = serial.Serial(self.__port1, self.__baudrate, timeout=1)
- self.__serial1.flushInput()
- self.__serial1.flushOutput()
self.__serial2 = serial.Serial(self.__port2, self.__baudrate, timeout=1)
- self.__serial2.flushInput()
- self.__serial2.flushOutput()
def __del__(self):
self.__serial1.close()
@@ -43,6 +39,12 @@ class Qduplex(unittest.TestCase):
def execute(self):
# generate a random uuid
test_uuid = str(uuid.uuid4()).encode()
+
+ # clean serial ports
+ self.__serial1.flushInput()
+ self.__serial1.flushOutput()
+ self.__serial2.flushInput()
+ self.__serial2.flushOutput()
# send the uuid through serial port
self.__serial1.write(test_uuid)
time.sleep(0.05) # there might be a small delay
@@ -52,7 +54,13 @@ class Qduplex(unittest.TestCase):
if self.__serial2.readline() != test_uuid:
self.fail("failed: port {} write/read mismatch".format(self.__port2))
- test_uuid = str(uuid.uuid4()).encode()
+ time.sleep(0.05) # there might be a small delay
+
+ # clean serial ports
+ self.__serial1.flushInput()
+ self.__serial1.flushOutput()
+ self.__serial2.flushInput()
+ self.__serial2.flushOutput()
# send the uuid through serial port
self.__serial2.write(test_uuid)
time.sleep(0.05) # there might be a small delay