diff --git a/.circleci/config.yml b/.circleci/config.yml index fd52bbb..becca98 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: diff --git a/tests/__init__.py b/tests/__init__.py index e69de29..cd186f0 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -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()