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

retry on keyerror during requests #68

Merged
merged 1 commit into from Jun 18, 2022
Merged

retry on keyerror during requests #68

merged 1 commit into from Jun 18, 2022

Conversation

ghost
Copy link

@ghost ghost commented Jun 17, 2022

Pytest sometimes deletes PYTEST_CURRENT_TEST while requests
is calling urllib's getproxies_environment.
This should probably be fixed in urllib.

We see this quite often in fact:

03:40:33  ---------------------------- Captured log teardown -----------------------------
03:40:33  06-17-2022 02:00:12 - ERROR: 'PYTEST_CURRENT_TEST'
03:40:33  Traceback (most recent call last):
03:40:33    File "/home/jenkins/workspace/PVS_QA_Automation_main/venv/lib/python3.9/site-packages/testrail_api/_session.py", line 156, in request
03:40:33      response = self.__session.request(
03:40:33    File "/home/jenkins/workspace/PVS_QA_Automation_main/venv/lib/python3.9/site-packages/requests/sessions.py", line 577, in request
03:40:33      settings = self.merge_environment_settings(
03:40:33    File "/home/jenkins/workspace/PVS_QA_Automation_main/venv/lib/python3.9/site-packages/requests/sessions.py", line 759, in merge_environment_settings
03:40:33      env_proxies = get_environ_proxies(url, no_proxy=no_proxy)
03:40:33    File "/home/jenkins/workspace/PVS_QA_Automation_main/venv/lib/python3.9/site-packages/requests/utils.py", line 828, in get_environ_proxies
03:40:33      return getproxies()
03:40:33    File "/nix/store/5bh6rpya1ar6l49vrhx1rg58dsa42906-python3-3.9.6/lib/python3.9/urllib/request.py", line 2498, in getproxies_environment
03:40:33      for name, value in os.environ.items():
03:40:33    File "/nix/store/5bh6rpya1ar6l49vrhx1rg58dsa42906-python3-3.9.6/lib/python3.9/_collections_abc.py", line 850, in __iter__
03:40:33      yield (key, self._mapping[key])
03:40:33    File "/nix/store/5bh6rpya1ar6l49vrhx1rg58dsa42906-python3-3.9.6/lib/python3.9/os.py", line 679, in __getitem__
03:40:33      raise KeyError(key) from None
03:40:33  KeyError: 'PYTEST_CURRENT_TEST'

See related patches:
reportportal/client-Python#39
reportportal/client-Python#40
reportportal/client-Python#96

Pytest sometimes deletes PYTEST_CURRENT_TEST while requests
is calling urllib's getproxies_environment.
This should probably be fixed in urllib.
@tolstislon tolstislon merged commit 73fdfd9 into tolstislon:master Jun 18, 2022
@ghost ghost deleted the fix/pytest-current-test-keyerror branch June 19, 2022 11:52
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.

None yet

1 participant