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

Fix USB tests working with python 3 #11520

Closed
wants to merge 1 commit into from

Conversation

OPpuolitaival
Copy link
Contributor

Description

Fix USB related host_test python scripts to work on python 3 also

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@jussisip could you test this?

Release Notes

@jamesbeyond
Copy link
Contributor

@fkjagodzinski could you have a look?

Copy link
Member

@fkjagodzinski fkjagodzinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OPpuolitaival did you have any problems with these lines? I run usb tests on latest master d0b5ba6 with Python3 and these did not cause problems. I had to update other lines though -- fkjagodzinski@96581ff. Feel free to cherry-pick this patch here.

@@ -647,7 +647,7 @@ def get_descriptor_test(dev, vendor_id, product_id, log):
# device descriptor
try:
ret = get_descriptor(dev, (DESC_TYPE_DEVICE << 8) | (0 << 0), 0, DEVICE_DESC_SIZE)
dev_desc = dict(zip(device_descriptor_keys, device_descriptor_parser.unpack(ret)))
dev_desc = dict(list(zip(device_descriptor_keys, device_descriptor_parser.unpack(ret))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to make a list here. dict() can handle generators just fine.

@@ -194,7 +194,7 @@ def send_data_sequence(self, chunk_size=1):
return
mbed_serial.reset_output_buffer()
mbed_serial.dtr = True
for byteval in itertools.chain(reversed(range(0x100)), range(0x100)):
for byteval in itertools.chain(reversed(list(range(0x100))), list(range(0x100))):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add list() here.

@kotkcy
Copy link
Contributor

kotkcy commented Sep 20, 2019

I tried to verify these changes on MAC - usb tests still FAILED...

@kotkcy
Copy link
Contributor

kotkcy commented Sep 20, 2019

On Windows I saw the same errors...

@OPpuolitaival
Copy link
Contributor Author

I did use 2to3 for these changes.. that normally find out problems quite well

@fkjagodzinski
Copy link
Member

I did use 2to3 for these changes.. that normally find out problems quite well

Yeah, the changes seem reasonable in general as they cover tha API changes (generators returned instead of objects). In this particular case these changes are unnecessary.

@OPpuolitaival
Copy link
Contributor Author

Cannot test with Mac. I ask my colleague to test this on Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants