@@ -6,6 +6,7 @@ set -o errexit # Exit the script with error if any of the commands fail
6
6
# AUTH Set to enable authentication. Defaults to "noauth"
7
7
# SSL Set to enable SSL. Defaults to "nossl"
8
8
# PYTHON_BINARY The Python version to use. Defaults to whatever is available
9
+ # PYTHON3_BINARY Path to a working Python 3.5+ binary.
9
10
# GREEN_FRAMEWORK The green framework to test with, if any.
10
11
# C_EXTENSIONS Pass --no_ext to setup.py, or not.
11
12
# COVERAGE If non-empty, run the test suite with coverage.
22
23
AUTH=${AUTH:- noauth}
23
24
SSL=${SSL:- nossl}
24
25
PYTHON_BINARY=${PYTHON_BINARY:- }
26
+ PYTHON3_BINARY=${PYTHON3_BINARY:- python3}
25
27
GREEN_FRAMEWORK=${GREEN_FRAMEWORK:- }
26
28
C_EXTENSIONS=${C_EXTENSIONS:- }
27
29
COVERAGE=${COVERAGE:- }
@@ -170,11 +172,27 @@ if [ -n "$TEST_ENCRYPTION" ]; then
170
172
# Remove after BUILD-13574.
171
173
python -m pip install certifi
172
174
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
173
182
pushd ${DRIVERS_TOOLS} /.evergreen/csfle
174
183
python -u lib/kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 8000 &
175
184
python -u lib/kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 8001 &
176
185
trap ' kill $(jobs -p)' EXIT HUP
177
186
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
178
196
fi
179
197
180
198
PYTHON_IMPL=$( $PYTHON -c " import platform, sys; sys.stdout.write(platform.python_implementation())" )
0 commit comments