-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Corrected iteritems py2/3 compatability in test_api.py #6886
Conversation
/morph build |
@@ -17,6 +17,7 @@ | |||
Author: Przemyslaw Wirkus <Przemyslaw.wirkus@arm.com> | |||
""" | |||
from __future__ import print_function | |||
import six |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
six
is not currently a required package from mbed-os, so we can't use this without adding it as a requirement.
But see my other suggestion below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh. I was under the impression that six was already required due to #5022. It looks like requirements needs to be updated regardless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, yeah that's definitely using that. Its a very common package so maybe it just works most of the time? Well maybe it wouldn't hurt to add it as an explicit dependency in requirements.txt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guess is that a different package ends up installing it as a dependency. I noticed it showed up after a fresh virtual environment.
if pred(test_identity): | ||
test_paths.append(path) | ||
|
||
# Drop identity besides name | ||
return {name: paths for (name, _, _, _), paths in tests.iteritems()} | ||
return {name: paths for (name, _, _, _), paths in six.iteritems(tests)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using six
and iteritems
, you can just use items
.
return {name: paths for (name, _, _, _), paths in tests.items()}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm... When I first came across the bug, I found something pointing to items() as performing much worse than six.iteritems(). Since I can't seen to find that document again, I'll make the change.
Build : SUCCESSBuild number : 1981 Triggering tests/morph test |
Exporter Build : ABORTEDBuild number : 1631 |
Test : FAILUREBuild number : 1793 |
/morph build |
Build : SUCCESSBuild number : 1982 Triggering tests/morph test |
Test : SUCCESSBuild number : 1794 |
Exporter Build : FAILUREBuild number : 1633 |
/morph export-build |
Exporter Build : SUCCESSBuild number : 1634 |
@bridadan If you're alright with simply adding six to requirements, could you re-review? |
Description
Fixes an iteritems compatibility between py2 and py3.
Discovered whilst finalizing py3 support for mbed-cli circleci tests.
Pull request type