mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #11546 from fkjagodzinski/test_update-usb-python3
Tests: USB: Fix Python 3 compatibilitypull/11614/head
commit
c3aedbf343
|
@ -1376,7 +1376,7 @@ def ep_test_abort(dev, log, verbose=False):
|
||||||
payload_size = (NUM_PACKETS_UNTIL_ABORT + NUM_PACKETS_AFTER_ABORT) * ep_out.wMaxPacketSize
|
payload_size = (NUM_PACKETS_UNTIL_ABORT + NUM_PACKETS_AFTER_ABORT) * ep_out.wMaxPacketSize
|
||||||
num_bytes_written = 0
|
num_bytes_written = 0
|
||||||
while num_bytes_written < payload_size:
|
while num_bytes_written < payload_size:
|
||||||
payload_out = array.array('B', (num_bytes_written/ep_out.wMaxPacketSize
|
payload_out = array.array('B', (num_bytes_written//ep_out.wMaxPacketSize
|
||||||
for _ in range(ep_out.wMaxPacketSize)))
|
for _ in range(ep_out.wMaxPacketSize)))
|
||||||
try:
|
try:
|
||||||
num_bytes_written += ep_out.write(payload_out)
|
num_bytes_written += ep_out.write(payload_out)
|
||||||
|
|
|
@ -24,6 +24,7 @@ import uuid
|
||||||
import sys
|
import sys
|
||||||
import serial
|
import serial
|
||||||
import serial.tools.list_ports as stlp
|
import serial.tools.list_ports as stlp
|
||||||
|
import six
|
||||||
import mbed_host_tests
|
import mbed_host_tests
|
||||||
|
|
||||||
|
|
||||||
|
@ -268,7 +269,7 @@ class USBSerialTest(mbed_host_tests.BaseHostTest):
|
||||||
mbed_serial.reset_output_buffer()
|
mbed_serial.reset_output_buffer()
|
||||||
mbed_serial.dtr = True
|
mbed_serial.dtr = True
|
||||||
try:
|
try:
|
||||||
payload = mbed_serial.read(LINE_CODING_STRLEN)
|
payload = six.ensure_str(mbed_serial.read(LINE_CODING_STRLEN))
|
||||||
while len(payload) == LINE_CODING_STRLEN:
|
while len(payload) == LINE_CODING_STRLEN:
|
||||||
baud, bits, parity, stop = (int(i) for i in payload.split(','))
|
baud, bits, parity, stop = (int(i) for i in payload.split(','))
|
||||||
new_line_coding = {
|
new_line_coding = {
|
||||||
|
@ -277,7 +278,7 @@ class USBSerialTest(mbed_host_tests.BaseHostTest):
|
||||||
'parity': self._PARITIES[parity],
|
'parity': self._PARITIES[parity],
|
||||||
'stopbits': self._STOPBITS[stop]}
|
'stopbits': self._STOPBITS[stop]}
|
||||||
mbed_serial.apply_settings(new_line_coding)
|
mbed_serial.apply_settings(new_line_coding)
|
||||||
payload = mbed_serial.read(LINE_CODING_STRLEN)
|
payload = six.ensure_str(mbed_serial.read(LINE_CODING_STRLEN))
|
||||||
except serial.SerialException as exc:
|
except serial.SerialException as exc:
|
||||||
self.log('TEST ERROR: {}'.format(exc))
|
self.log('TEST ERROR: {}'.format(exc))
|
||||||
self.notify_complete(False)
|
self.notify_complete(False)
|
||||||
|
|
|
@ -5,7 +5,7 @@ junit-xml==1.8
|
||||||
pyyaml==4.2b1
|
pyyaml==4.2b1
|
||||||
jsonschema==2.6.0
|
jsonschema==2.6.0
|
||||||
future==0.16.0
|
future==0.16.0
|
||||||
six==1.11.0
|
six==1.12.0
|
||||||
mbed-cloud-sdk>=2.0.6,<2.1
|
mbed-cloud-sdk>=2.0.6,<2.1
|
||||||
requests>=2.20,<2.21
|
requests>=2.20,<2.21
|
||||||
idna>=2,<2.8
|
idna>=2,<2.8
|
||||||
|
|
Loading…
Reference in New Issue