Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: USB: Fix Python 3 compatibility #11546

Merged
merged 2 commits into from
Sep 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TESTS/host_tests/pyusb_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
num_bytes_written = 0
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)))
try:
num_bytes_written += ep_out.write(payload_out)
Expand Down
5 changes: 3 additions & 2 deletions TESTS/host_tests/usb_device_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import sys
import serial
import serial.tools.list_ports as stlp
import six
import mbed_host_tests


Expand Down Expand Up @@ -268,7 +269,7 @@ def change_line_coding(self):
mbed_serial.reset_output_buffer()
mbed_serial.dtr = True
try:
payload = mbed_serial.read(LINE_CODING_STRLEN)
payload = six.ensure_str(mbed_serial.read(LINE_CODING_STRLEN))
while len(payload) == LINE_CODING_STRLEN:
baud, bits, parity, stop = (int(i) for i in payload.split(','))
new_line_coding = {
Expand All @@ -277,7 +278,7 @@ def change_line_coding(self):
'parity': self._PARITIES[parity],
'stopbits': self._STOPBITS[stop]}
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:
self.log('TEST ERROR: {}'.format(exc))
self.notify_complete(False)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ junit-xml==1.8
pyyaml==4.2b1
jsonschema==2.6.0
future==0.16.0
six==1.11.0
six==1.12.0
mbed-cloud-sdk>=2.0.6,<2.1
requests>=2.20,<2.21
idna>=2,<2.8
Expand Down