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

Merged
merged 2 commits into from May 15, 2018

Conversation

Projects
None yet
4 participants
@cmonr
Contributor

cmonr commented May 11, 2018

Description

Fixes an iteritems compatibility between py2 and py3.

Discovered whilst finalizing py3 support for mbed-cli circleci tests.

Pull request type

[x] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change
@cmonr

This comment has been minimized.

Contributor

cmonr commented May 11, 2018

/morph build

@@ -17,6 +17,7 @@
Author: Przemyslaw Wirkus <Przemyslaw.wirkus@arm.com>
"""
from __future__ import print_function
import six

This comment has been minimized.

@bridadan

bridadan May 11, 2018

Contributor

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.

This comment has been minimized.

@cmonr

cmonr May 11, 2018

Contributor

Huh. I was under the impression that six was already required due to #5022. It looks like requirements needs to be updated regardless.

This comment has been minimized.

@bridadan

bridadan May 11, 2018

Contributor

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?

This comment has been minimized.

@cmonr

cmonr May 14, 2018

Contributor

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)}

This comment has been minimized.

@bridadan

bridadan May 11, 2018

Contributor

Instead of using six and iteritems, you can just use items.

return {name: paths for (name, _, _, _), paths in tests.items()}

This comment has been minimized.

@cmonr

cmonr May 11, 2018

Contributor

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.

@mbed-ci

This comment has been minimized.

mbed-ci commented May 11, 2018

Build : SUCCESS

Build number : 1981
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6886/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@cmonr

This comment has been minimized.

Contributor

cmonr commented May 11, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented May 11, 2018

Build : SUCCESS

Build number : 1982
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6886/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@cmonr

This comment has been minimized.

Contributor

cmonr commented May 12, 2018

/morph export-build

@mbed-ci

This comment has been minimized.

@cmonr

This comment has been minimized.

Contributor

cmonr commented May 14, 2018

@bridadan If you're alright with simply adding six to requirements, could you re-review?

@cmonr cmonr added ready for merge and removed needs: review labels May 14, 2018

@cmonr cmonr merged commit 83d7444 into ARMmbed:master May 15, 2018

13 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
travis-ci/astyle Passed, 845 warnings
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 8864 cycles (-818 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/littlefs Passed, code size is 9964B
Details
travis-ci/tools Local tools testing has passed
Details

@cmonr cmonr removed the ready for merge label May 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment