Since GitHub has the bad manners to return bare strings for some API
endpoints, one sharp edge has been that JSON decoding errors were masked
since we wrap the string in a dictionary. However, this makes it
difficult to debug malformed JSON in replay data, so re-raise the
exception if the first character is a { or [ (IE, it's an object or
list.)
Since the headers that led to an exception are also useful, firstly pass
them into the constructor, and then export them in a property. Test one
specific use case to make sure of coverage.
Fixes#1814
When IncompletableObject was added, it was only added to
GithubException, and not imported directly into the github namespace
like other exceptions. Correct that, and clean up the resultant now
unrequired import.
Currently, we were checking for an uppercase header if GitHub was
refusing our authentication because we didn't provide a token. Requests
returns headers with all lowercase. Fix the const, and add a test for
good measure.
Fixes#1273
If a returned object from GitHub does not include an URL, that object
can not be completed, and used to fail with an obscure traceback saying
NoneType has no method startswith. Check for this, and raise
IncompletableObject instead.
With the Python 2.7 deadline fast approaching, modernize the codebase
making use of the modernize module to switch to using six, as well as
other upcoming features, such as absolute imports . Stop using 2to3
for Travis, yay!
# Problem #
The `.whl` available on PyPi for this repository contains its entire `tests` submodule.
The total size of the `pygithub` module is less than `1mb` without tests and `>23mb` with.
Previous discussions on this topic indicated the removal of tests would be accepted if someone created a pull request to do so: https://github.com/PyGithub/PyGithub/issues/672
This is that pull request! 😄
# Solution/Implementation #
- Moved "tests" to root of the repository ( outside the package )
- Added `tests.` module path to the imports in `AllTests.py`
- Updated `setup.py`
- Removed `package_data` from product
- Removed "tests" from packages definition
- Repointed `test_suite` to new location
- Updated `travis.yml`
- Added conditional ( if not `py2.7` ) conversion of code to `py3`
_... apologies for all the failed build spam below - new to working with Travis CI / had some gotcha moments!_