Skip to content

Commit 1fb9751

Browse files
authored
Merge pull request #23 from cognifloyd/ssl-handshake-errors
2 parents 145e176 + fa80010 commit 1fb9751

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.circleci/config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ jobs:
4040
# can't intercept the error and cause non-fatal exit in case pack
4141
# doesn't declare support for Python 3
4242
shell: /bin/bash
43-
command: ~/ci/.circle/test ; ~/ci/.circle/exit_on_py3_checks $?
43+
# eventlet monkey_patch as early as possible (has to be in activate as nosetests gets reinstalled during test phase)
44+
command: |
45+
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
46+
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
47+
~/ci/.circle/test ; ~/ci/.circle/exit_on_py3_checks $?
4448
- save_cache:
4549
key: v1-dependency-cache-py36-{{ checksum "requirements.txt" }}
4650
paths:

tests/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# with requests <=2.23.0, requests forced a re-import of ssl libs.
2+
# Once it stopped doing that, the ssl module was imported somewhere
3+
# before eventlet monkey patching occurred, resulting in some
4+
# infinite recursion errors. Putting this in the base test file
5+
# or in the individual test files was not soon enough. Putting this
6+
# here does, however, seem to be early enough to resolve the errors.
7+
from st2common.util.monkey_patch import monkey_patch
8+
9+
monkey_patch()

0 commit comments

Comments
 (0)