Python 2.6 and 3.x support fixes and enhanced versions testing #73
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request is mostly a superset of Bernardo Heynemann's PR #70 (I omitted the last two commits in that PR as they seemed off-topic, worthwhile as they might otherwise be).
In addition to his fixes for 2.6 and py3k bugs, using the excellent
six
compatibility library, I enhanced the testing setup for slumber, updating the.travis.yml
configuration to add testing for all the Python versions (except 2.5) that it supports, and as you can see from the Travis report on this PR, all tests are passing on all those versions. I also made some tweaks to thetox.ini
he created, so that it doesn't install tox itself (and all of its dependencies) in the virtualenvs that it creates for testing slumber on different Python versions, and so that it tests Python 3.1 if available (Travis no longer supports Python 3.1, so it's commented out in.travis.yml
).I also fixed some other Py3K issues that I ran into while using slumber (before I saw his PR). In particular:
iteritems()
method in several places was not compatible with py3k; I usedsix.iteritems()
function, which is defined appropriately for Python 2 or 3./b'url-path-comp'/
rather than as/url-path-comp/
. Passing them as bytearray made it worse, as they would then be formatted as/bytearray(b'url-path-comp')/
! There were also some latent issues with encoding compatibility and mixing Unicode and bytes, where urlsplit or urlunsplit could raiseUnicodeDecodeError
exceptions, and other cases where users could pass in bytes data with incompatible encodings that would not raise exceptions.For the second issue, I added several cases to the test suite for url_join, including checks that
TypeError
exceptions are raised for potentially incompatibly encoded data passed to url_join (if you need non-ASCII data in the extra arguments, you need to pass them (and the base URL) as Unicode, not bytes).In @merwok's comment on PR #70, issue #56 is mentioned, specifically the possibility of syncing
tox.ini
and.travis.yml
using the panci tool. I installed panci and ran it against those files in this PR, but I found the output to be somewhat inferior to the versions of those files in this PR; the resulting files lose functionality and/or cause test failures, and I didn't feel like fixing panci too.If you really want to generate one from the other, generate
tox.ini
from.travis.yml
since the only lost functionality is Python 3.1 testing, and the useless installation of tox and its dependencies inside the virtualenvs for testing slumber (which I fixed in d534651) is annoying but harmless, and I don't think you'll get any test failures.