Skip to content
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

Generalize the types of errors caught #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlanCoding
Copy link

I'm somewhat-frequently seeing this as a result of github flake.

E               File "/home/ec2-user/venvs/test-controller/lib64/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
E                 res = hook_impl.function(*args)
E               File "/home/ec2-user/venvs/test-controller/lib64/python3.9/site-packages/pytest_github/plugin.py", line 333, in pytest_itemcollected
E                 self._issue_cache[url] = IssueWrapper(self.api.issue(username, repository, number), self)
E               File "/home/ec2-user/venvs/test-controller/lib64/python3.9/site-packages/github3/github.py", line 1176, in issue
E                 json = self._json(self._get(url), 200)
E               File "/home/ec2-user/venvs/test-controller/lib64/python3.9/site-packages/github3/models.py", line 216, in _get
E                 return self._request("get", url, **kwargs)
E               File "/home/ec2-user/venvs/test-controller/lib64/python3.9/site-packages/github3/models.py", line 206, in _request
E                 raise exceptions.ConnectionError(exc)
E             github3.exceptions.ConnectionError: <class 'requests.exceptions.ReadTimeout'>: A connection-level exception occurred: HTTPSConnectionPool(host='api.github.com', port=443): Read timed out. (read timeout=10)
E           assert False

If you consult the library used for github3, you can see that the ConnectionError is not a subclass of github3.exceptions.GitHubError which is what is currently caught.

This results in the test run being aborted with this error and something about an "internal error" in pytest. It also causes the pytest-mp to collect an inconsistent number of tests, which I can't fully understand now.

>>> import github3
>>> issubclass(github3.exceptions.ConnectionError, github3.exceptions.GitHubException)
True
>>> issubclass(github3.exceptions.GitHubError, github3.exceptions.GitHubException)
True

This change should catch both scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant