pytest-github
pytest-github copied to clipboard
Fail more gracefully when we hit API rate limit
I saw a test failure that stemmed from this plugin hitting the API rate limit....the plugin should perhaps fail more gracefully or skip the test and raise a warning instead of just failing with a 403. Perhaps the warning could even point the user to the docs for the API limits on github.
Traceback (most recent call last):
File "/root/.venv/lib/python2.7/site-packages/pytest_github/plugin.py", line 276, in pytest_runtest_setup
if not issue.is_resolved:
File "/root/.venv/lib/python2.7/site-packages/pytest_github/plugin.py", line 151, in is_resolved
if not self.is_closed and not set(self._gh_plugin.completed_labels).intersection(self.labels):
File "/root/.venv/lib/python2.7/site-packages/pytest_github/plugin.py", line 146, in labels
return [l.name for l in labels]
File "/root/.venv/lib/python2.7/site-packages/github3/structs.py", line 76, in __iter__
json = self._get_json(response)
File "/root/.venv/lib/python2.7/site-packages/github3/structs.py", line 111, in _get_json
return self._json(response, 200)
File "/root/.venv/lib/python2.7/site-packages/github3/models.py", line 156, in _json
raise exceptions.error_for(response)
ForbiddenError: 403 API rate limit exceeded for user ID <secret>