Skip to content

Commit 8e5dbc9

Browse files
committed
PYTHON-2128 Fix test_ssl_pem_passphrase
1 parent 6ee80ce commit 8e5dbc9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.evergreen/run-pyopenssl-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fi
2121
$PYTHON -m virtualenv pyopenssltest
2222
trap "deactivate; rm -rf pyopenssltest" EXIT HUP
2323
. pyopenssltest/bin/activate
24-
pip install pyopenssl>=17.2.0 service_identity>=18.1.0
24+
pip install pyopenssl>=17.2.0 "requests<3.0.0" service_identity>=18.1.0
2525
pip list
2626
python -c 'import sys; print(sys.version)'
2727
python setup.py test

test/test_ssl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343

4444
_HAVE_PYOPENSSL = False
4545
try:
46+
# All of these must be available to use PyOpenSSL
4647
import OpenSSL
48+
import requests
49+
import service_identity
4750
_HAVE_PYOPENSSL = True
4851
except ImportError:
4952
pass
@@ -190,8 +193,7 @@ def test_ssl_pem_passphrase(self):
190193
#
191194
# --sslPEMKeyFile=/path/to/pymongo/test/certificates/server.pem
192195
# --sslCAFile=/path/to/pymongo/test/certificates/ca.pem
193-
vi = sys.version_info
194-
if vi[0] == 2 and vi < (2, 7, 9) and not _ssl.IS_PYOPENSSL:
196+
if not hasattr(ssl, 'SSLContext') and not _ssl.IS_PYOPENSSL:
195197
self.assertRaises(
196198
ConfigurationError,
197199
MongoClient,

0 commit comments

Comments
 (0)