PYTHON-2148 Test PyOpenSSL support on Windows

This commit is contained in:
Shane Harvey 2020-03-03 11:55:43 -08:00
parent e485c07109
commit 2157dc58ea
3 changed files with 75 additions and 12 deletions

View File

@ -1288,6 +1288,12 @@ axes:
batchtime: 10080 # 7 days
variables:
libmongocrypt_url: https://s3.amazonaws.com/mciuploads/libmongocrypt/windows-test/master/latest/libmongocrypt.tar.gz
- id: windows-64-vsMulti-small
display_name: "Windows 64"
run_on: windows-64-vsMulti-small
batchtime: 10080 # 7 days
variables:
libmongocrypt_url: https://s3.amazonaws.com/mciuploads/libmongocrypt/windows-test/master/latest/libmongocrypt.tar.gz
# Test with authentication?
- id: auth
@ -1399,23 +1405,27 @@ axes:
- id: "win-vs2010-3.4"
display_name: "Python 3.4"
variables:
PYTHON_BINARY: "/cygdrive/c/python/Python34/python.exe"
PYTHON_BINARY: "C:/python/Python34/python.exe"
- id: "win-vs2015-2.7"
display_name: "Python 2.7"
variables:
PYTHON_BINARY: "/cygdrive/c/python/Python27/python.exe"
PYTHON_BINARY: "C:/python/Python27/python.exe"
- id: "win-vs2015-3.5"
display_name: "Python 3.5"
variables:
PYTHON_BINARY: "/cygdrive/c/python/Python35/python.exe"
PYTHON_BINARY: "C:/python/Python35/python.exe"
- id: "win-vs2015-3.6"
display_name: "Python 3.6"
variables:
PYTHON_BINARY: "/cygdrive/c/python/Python36/python.exe"
PYTHON_BINARY: "C:/python/Python36/python.exe"
- id: "win-vs2015-3.7"
display_name: "Python 3.7"
variables:
PYTHON_BINARY: "/cygdrive/c/python/Python37/python.exe"
PYTHON_BINARY: "C:/python/Python37/python.exe"
- id: "win-vs2015-3.8"
display_name: "Python 3.8"
variables:
PYTHON_BINARY: "C:/python/Python38/python.exe"
# Choice of mod_wsgi version
- id: mod-wsgi-version
@ -1729,7 +1739,7 @@ buildvariants:
python-version: ["2.7", "3.4", "3.5", "3.6", "3.7", "pypy", "pypy3.5"]
auth: "*"
ssl: "ssl"
display_name: "PyOpenSSL ${python-version} ${platform} ${auth}"
display_name: "PyOpenSSL ${platform} ${python-version} ${auth}"
tasks:
- "pyopenssl"
@ -1740,7 +1750,7 @@ buildvariants:
- rhel70 # CPython 2.7.5
auth: "*"
ssl: "ssl"
display_name: "PyOpenSSL Pre-2.7.9 Python ${platform} ${auth}"
display_name: "PyOpenSSL ${platform} Pre-2.7.9 Python ${auth}"
tasks:
- "pyopenssl"
@ -1753,6 +1763,16 @@ buildvariants:
tasks:
- "pyopenssl"
- matrix_name: "tests-pyopenssl-windows"
matrix_spec:
platform: windows-64-vsMulti-small
python-version: ["win-vs2015-2.7", "win-vs2010-3.4", "win-vs2015-3.5", "win-vs2015-3.6", "win-vs2015-3.7", "win-vs2015-3.8"]
auth: "*"
ssl: "ssl"
display_name: "PyOpenSSL ${platform} ${python-version} ${auth}"
tasks:
- "pyopenssl"
- matrix_name: "tests-python-version-rhel62-test-encryption"
matrix_spec:
platform: rhel62

View File

@ -5,20 +5,42 @@ set -o errexit
if [ -z "$PYTHON_BINARY" ]; then
echo "No python binary specified"
PYTHON_BINARY=$(command -v python || command -v python3) || true
PYTHON=$(command -v python || command -v python3) || true
if [ -z "$PYTHON_BINARY" ]; then
echo "Cannot test without python or python3 installed!"
exit 1
fi
else
PYTHON="$PYTHON_BINARY"
fi
$PYTHON_BINARY -m virtualenv --never-download --no-wheel ocsptest
. ocsptest/bin/activate
if $PYTHON -m virtualenv --version; then
VIRTUALENV="$PYTHON -m virtualenv"
elif command -v virtualenv; then
# We can remove this fallback after:
# https://github.com/10gen/mongo-python-toolchain/issues/8
VIRTUALENV="$(command -v virtualenv) -p $PYTHON"
else
echo "Cannot test without virtualenv"
exit 1
fi
$VIRTUALENV --never-download --no-wheel ocsptest
if [ "Windows_NT" = "$OS" ]; then
. ocsptest/Scripts/activate
else
. ocsptest/bin/activate
fi
trap "deactivate; rm -rf ocsptest" EXIT HUP
IS_PYTHON_2=$(python -c "import sys; sys.stdout.write('1' if sys.version_info < (3,) else '0')")
if [ $IS_PYTHON_2 = "1" ]; then
echo "Using a Python 2"
# Upgrade pip to install the cryptography wheel and not the tar.
# <20.1 because 20.0.2 says a future release may drop support for 2.7.
pip install --upgrade 'pip<20.1'
# Upgrade setuptools because cryptography requires 18.5+.
# <45 because 45.0 dropped support for 2.7.
pip install --upgrade 'setuptools<45'
fi

View File

@ -9,6 +9,7 @@ export CLIENT_PEM="$DRIVERS_TOOLS/.evergreen/x509gen/client.pem"
export CA_PEM="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem"
if [ -z "$PYTHON_BINARY" ]; then
echo "No python binary specified"
PYTHON=$(command -v python || command -v python3) || true
if [ -z "$PYTHON" ]; then
echo "Cannot test without python or python3 installed!"
@ -18,13 +19,33 @@ else
PYTHON="$PYTHON_BINARY"
fi
$PYTHON -m virtualenv pyopenssltest
. pyopenssltest/bin/activate
if $PYTHON -m virtualenv --version; then
VIRTUALENV="$PYTHON -m virtualenv"
elif command -v virtualenv; then
# We can remove this fallback after:
# https://github.com/10gen/mongo-python-toolchain/issues/8
VIRTUALENV="$(command -v virtualenv) -p $PYTHON"
else
echo "Cannot test without virtualenv"
exit 1
fi
$VIRTUALENV pyopenssltest
if [ "Windows_NT" = "$OS" ]; then
. pyopenssltest/Scripts/activate
else
. pyopenssltest/bin/activate
fi
trap "deactivate; rm -rf pyopenssltest" EXIT HUP
IS_PYTHON_2=$(python -c "import sys; sys.stdout.write('1' if sys.version_info < (3,) else '0')")
if [ $IS_PYTHON_2 = "1" ]; then
echo "Using a Python 2"
# Upgrade pip to install the cryptography wheel and not the tar.
# <20.1 because 20.0.2 says a future release may drop support for 2.7.
pip install --upgrade 'pip<20.1'
# Upgrade setuptools because cryptography requires 18.5+.
# <45 because 45.0 dropped support for 2.7.
pip install --upgrade 'setuptools<45'
fi