-
Notifications
You must be signed in to change notification settings - Fork 72
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
Add support for Python 2 and 3 #28
Conversation
str(foo) would be satisfactory in place of "{}".format(foo) but use the latter form for the sake of consistency.
py3's read() returns a byte array, not a string.
Drops support for Python 2.5.
👍 |
Thanks a lot for taking this on. Especially adding some basic unit tests. Can you update the |
Tox is configured to test against multiple Python runtimes. Travis invokes Tox. Travis was also configured to test against multiple Python runtimes. Something smelt wrong. While this worked, I think your CI was doing unnecessary work: - Travis spawns 4x jobs on each build. Travis provisions each job with an initial virtualenv. In this initial Travis virtualenv, 'python' resolves to whatever was configured in .travis.yml. This python interpreter is used to install tox and start it. - Tox starts up. Tox spawns 4x new virtualenvs. In these Tox virtualenvs, 'python' resolves to whatever was configured in tox.ini. These are the python interpreters that ultimately run the linter and unit tests. The effect was multiplicative: 4 x 4 + 4 = 20 virtualenvs were being spawned in CI. I think this worked because Travis pre-provision a variety of Python runtimes on all their job instances: not just whichever runtime was selected for the job from the 'python' sequence in .travis.yml. All runtimes are accessible at pythonX.Y, which is why all Tox environments succeeded across all Travis jobs. Following this commit, Travis will still spawn 4x parallel jobs on each build, but Tox should limit itself to just one Python runtime target for each Travis job. This should make for fewer virtualenvs (4 + 4 = 8) and faster CI builds. This arrangement should also work in local testing (Tox without Travis).
Done. Even with the new unit tests in c938946, the changes to the Travis configuration in e6b9d20 have halved CI build times: https://travis-ci.org/dropbox/pygerduty/builds/84478461 You might want to check your other projects for the same problem. More comprehensive (time consuming) test suites will amplify the negative effect. Cheers. |
Yeah, I'd noticed that problem as I asked you to add the tests. I don't normally use tox (that was another pull request) so thanks for fixing that up as well! |
Add support for Python 2 and 3
This has been pushed up to PyPI as Thanks again for the work here! |
Thanks @saj and @chris-martin & for the quick release @gmjosack. |
Thanks everybody :) |
Fixes #22.
Please note that this pull request will drop support for Python 2.5.
Tested with:
I was forced to add a handful of unit tests to ensure basic functionality across the different runtimes. These tests offer minimal coverage. Tests for paginated responses and writes are missing. The tests that do exist may differ from your house style.