Skip to content

Commit c3aedbf

Browse files
authored
Merge pull request #11546 from fkjagodzinski/test_update-usb-python3
Tests: USB: Fix Python 3 compatibility
2 parents e4d2053 + 2b4b64f commit c3aedbf

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

TESTS/host_tests/pyusb_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ def ep_test_abort(dev, log, verbose=False):
13761376
payload_size = (NUM_PACKETS_UNTIL_ABORT + NUM_PACKETS_AFTER_ABORT) * ep_out.wMaxPacketSize
13771377
num_bytes_written = 0
13781378
while num_bytes_written < payload_size:
1379-
payload_out = array.array('B', (num_bytes_written/ep_out.wMaxPacketSize
1379+
payload_out = array.array('B', (num_bytes_written//ep_out.wMaxPacketSize
13801380
for _ in range(ep_out.wMaxPacketSize)))
13811381
try:
13821382
num_bytes_written += ep_out.write(payload_out)

TESTS/host_tests/usb_device_serial.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import sys
2525
import serial
2626
import serial.tools.list_ports as stlp
27+
import six
2728
import mbed_host_tests
2829

2930

@@ -268,7 +269,7 @@ def change_line_coding(self):
268269
mbed_serial.reset_output_buffer()
269270
mbed_serial.dtr = True
270271
try:
271-
payload = mbed_serial.read(LINE_CODING_STRLEN)
272+
payload = six.ensure_str(mbed_serial.read(LINE_CODING_STRLEN))
272273
while len(payload) == LINE_CODING_STRLEN:
273274
baud, bits, parity, stop = (int(i) for i in payload.split(','))
274275
new_line_coding = {
@@ -277,7 +278,7 @@ def change_line_coding(self):
277278
'parity': self._PARITIES[parity],
278279
'stopbits': self._STOPBITS[stop]}
279280
mbed_serial.apply_settings(new_line_coding)
280-
payload = mbed_serial.read(LINE_CODING_STRLEN)
281+
payload = six.ensure_str(mbed_serial.read(LINE_CODING_STRLEN))
281282
except serial.SerialException as exc:
282283
self.log('TEST ERROR: {}'.format(exc))
283284
self.notify_complete(False)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ junit-xml==1.8
55
pyyaml==4.2b1
66
jsonschema==2.6.0
77
future==0.16.0
8-
six==1.11.0
8+
six==1.12.0
99
mbed-cloud-sdk>=2.0.6,<2.1
1010
requests>=2.20,<2.21
1111
idna>=2,<2.8

0 commit comments

Comments
 (0)