@@ -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:- }
@@ -167,11 +169,28 @@ if [ -n "$TEST_ENCRYPTION" ]; then
167
169
168
170
# Start the mock KMS servers.
169
171
if [ " $OS " != " Windows_NT" ]; then
172
+ # The mock KMS server requires Python 3.5 with boto3.
173
+ IS_PRE_35=$( python -c " import sys; sys.stdout.write('1' if sys.version_info < (3, 5) else '0')" )
174
+ if [ $IS_PRE_35 = " 1" ]; then
175
+ echo " PYTHON3_BINARY: $PYTHON3_BINARY "
176
+ deactivate
177
+ createvirtualenv $PYTHON3_BINARY venv-kms
178
+ python -m pip install boto3
179
+ fi
170
180
pushd ${DRIVERS_TOOLS} /.evergreen/csfle
171
181
python -u lib/kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 8000 &
172
182
python -u lib/kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 8001 &
173
183
trap ' kill $(jobs -p)' EXIT HUP
174
184
popd
185
+ # Restore the test virtualenv.
186
+ if [ $IS_PRE_35 = " 1" ]; then
187
+ deactivate
188
+ if [ " Windows_NT" = " $OS " ]; then
189
+ . venv-encryption/Scripts/activate
190
+ else
191
+ . venv-encryption/bin/activate
192
+ fi
193
+ fi
175
194
fi
176
195
fi
177
196
0 commit comments