@@ -6,6 +6,7 @@ set -o errexit # Exit the script with error if any of the commands fail
66# AUTH Set to enable authentication. Defaults to "noauth"
77# SSL Set to enable SSL. Defaults to "nossl"
88# PYTHON_BINARY The Python version to use. Defaults to whatever is available
9+ # PYTHON3_BINARY Path to a working Python 3.5+ binary.
910# GREEN_FRAMEWORK The green framework to test with, if any.
1011# C_EXTENSIONS Pass --no_ext to setup.py, or not.
1112# COVERAGE If non-empty, run the test suite with coverage.
2223AUTH=${AUTH:- noauth}
2324SSL=${SSL:- nossl}
2425PYTHON_BINARY=${PYTHON_BINARY:- }
26+ PYTHON3_BINARY=${PYTHON3_BINARY:- python3}
2527GREEN_FRAMEWORK=${GREEN_FRAMEWORK:- }
2628C_EXTENSIONS=${C_EXTENSIONS:- }
2729COVERAGE=${COVERAGE:- }
@@ -170,11 +172,27 @@ if [ -n "$TEST_ENCRYPTION" ]; then
170172 # Remove after BUILD-13574.
171173 python -m pip install certifi
172174 fi
175+ # The mock KMS server requires Python >=3.5 with boto3.
176+ IS_PRE_35=$( python -c " import sys; sys.stdout.write('1' if sys.version_info < (3, 5) else '0')" )
177+ if [ $IS_PRE_35 = " 1" ]; then
178+ deactivate
179+ createvirtualenv $PYTHON3_BINARY venv-kms
180+ python -m pip install boto3
181+ fi
173182 pushd ${DRIVERS_TOOLS} /.evergreen/csfle
174183 python -u lib/kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 8000 &
175184 python -u lib/kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 8001 &
176185 trap ' kill $(jobs -p)' EXIT HUP
177186 popd
187+ # Restore the test virtualenv.
188+ if [ $IS_PRE_35 = " 1" ]; then
189+ deactivate
190+ if [ " Windows_NT" = " $OS " ]; then
191+ . venv-encryption/Scripts/activate
192+ else
193+ . venv-encryption/bin/activate
194+ fi
195+ fi
178196fi
179197
180198PYTHON_IMPL=$( $PYTHON -c " import platform, sys; sys.stdout.write(platform.python_implementation())" )
0 commit comments