Merge lp:~abentley/juju-ci-tools/more-py3 into lp:juju-ci-tools
Status: | Merged |
---|---|
Merged at revision: | 1932 |
Proposed branch: | lp:~abentley/juju-ci-tools/more-py3 |
Merge into: | lp:juju-ci-tools |
Diff against target: |
381 lines (+60/-47) 7 files modified
.bzrignore (+1/-0) jujupy/client.py (+4/-4) jujupy/fake.py (+1/-1) jujupy/tests/test_client.py (+34/-16) jujupy/tests/test_version_client.py (+10/-9) tests/__init__.py (+4/-0) tests/test_assess_resources.py (+6/-17) |
To merge this branch: | bzr merge lp:~abentley/juju-ci-tools/more-py3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Curtis Hovey (community) | code | Approve | |
Review via email: mp+319598@code.launchpad.net |
Commit message
Improve Python 3 compatibility.
Description of the change
This branch improves jujupy's compatibility with Python 3.
The bulk of this is due to string handling differences: We had been using string literals as expected values, where the actual value was a binary string. The simplest thing to do seems to be encoding the string to ascii.
The location of StringIO changed, so its imports had to be updated.
Python 3 dicts cannot be sorted, so in a few places I changed it to sort by application name, not sorting application data itself.
Similarly, in Python 3 the return value of dict.keys() is not a list, and is never equal to a list. So dict.keys() had to become list(dict.keys()).
Also, since iterator.next() is iterator.__next__ on Python 3, next(iterator) is used instead.
Python 2's TestCase.
jujupy.
(I have discovered there are more dependency inversions, especially with juju-ci-
Thank you very much.