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

Work around TLS errors #23

Merged
merged 6 commits into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ jobs:
# can't intercept the error and cause non-fatal exit in case pack
# doesn't declare support for Python 3
shell: /bin/bash
command: ~/ci/.circle/test ; ~/ci/.circle/exit_on_py3_checks $?
# eventlet monkey_patch as early as possible (has to be in activate as nosetests gets reinstalled during test phase)
command: |
echo "grep -q monkey_patch ~/virtualenv/bin/nosetests || sed -i -e '/^import re$/i from st2common.util.monkey_patch import monkey_patch\nmonkey_patch()\n' ~/virtualenv/bin/nosetests" >> ~/virtualenv/bin/activate
echo "grep -q pyopenssl\\.inject ~/virtualenv/bin/nosetests || sed -i -e '/^import re$/i from urllib3.contrib import pyopenssl\npyopenssl.inject_into_urllib3()\n' ~/virtualenv/bin/nosetests" >> ~/virtualenv/bin/activate
~/ci/.circle/test ; ~/ci/.circle/exit_on_py3_checks $?
- save_cache:
key: v1-dependency-cache-py36-{{ checksum "requirements.txt" }}
paths:
Expand Down
9 changes: 9 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# with requests <=2.23.0, requests forced a re-import of ssl libs.
# Once it stopped doing that, the ssl module was imported somewhere
# before eventlet monkey patching occurred, resulting in some
# infinite recursion errors. Putting this in the base test file
# or in the individual test files was not soon enough. Putting this
# here does, however, seem to be early enough to resolve the errors.
from st2common.util.monkey_patch import monkey_patch

monkey_patch()