-
Committer:
Dan Ryan
-
Date:
2020-01-16 00:52:59 UTC
-
Revision ID:
dan.ryan@canonical.com-20200116005259-lwt0zdsbglhx7qxw
Add python 3 compatibility to codebase and fix tests
- python3 compat - largely consists of adding absolute_import &
print_function imports from __future__, preferring io.open
- Prefer to use `requests.get` in a context manager when downloading
charms to avoid leaving connections open
- Incrementally compute sha384 of downloaded artifects simultaneously
while writing to disk to avoid extra overhead
- Add `git+file` VCS scheme to `GitSourceHandler` valid schemes list
- Update package requirement definitions to include conditional
`concurrent.futures` requirement for python2 only
- Add `tests` extra for installing test dependencies via
`pip install .[tests]` and `tests_require` for setuptools runner
- Update tests to use conditional import guards for `mock` vs
`unittest.mock` (python3 equivalent)
- Fix failing tests related to `requests.Response` which now
properly handles iterating over file or stream contents
- Implement context management methods on `requests.Response` mock
- Remove `git-daemon` based git tests in favor of `file:///` scheme
due to test flakiness (git daemon subprocess dies early in the run)
- Add `MANIFEST.in` for proper building of `setuptools` based sdist