Skip to content

Commit 188edeb

Browse files
committed
PYTHON-2366 Test OCSP+FLE with Python 3.9 (#534)
PYTHON-2449 Move all pypy cryptography/pyopenssl testing to Debian 9.2 with OpenSSL 1.1.0f PYTHON-2449 Fix Windows cryptography installation by upgrading pip and using --prefer-binary (cherry picked from commit 3ecd947)
1 parent d808dae commit 188edeb

File tree

5 files changed

+61
-73
lines changed

5 files changed

+61
-73
lines changed

.evergreen/config.yml

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,7 @@ axes:
15611561
run_on: debian92-test
15621562
batchtime: 10080 # 7 days
15631563
variables:
1564+
python3_binary: "/opt/python/3.8/bin/python3"
15641565
libmongocrypt_url: https://s3.amazonaws.com/mciuploads/libmongocrypt/debian92/master/latest/libmongocrypt.tar.gz
15651566
- id: macos-1014
15661567
display_name: "macOS 10.14"
@@ -2160,14 +2161,14 @@ buildvariants:
21602161
- matrix_name: "tests-pyopenssl"
21612162
matrix_spec:
21622163
platform: ubuntu-16.04
2163-
python-version: ["2.7", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "pypy", "pypy3.5"]
2164+
python-version: ["2.7", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9"]
21642165
auth: "*"
21652166
ssl: "ssl"
21662167
pyopenssl: "*"
21672168
# Only test "noauth" with Python 3.7.
21682169
exclude_spec:
21692170
platform: ubuntu-16.04
2170-
python-version: ["2.7", "3.4", "3.5", "3.6", "3.8", "3.9", "pypy", "pypy3.5"]
2171+
python-version: ["2.7", "3.4", "3.5", "3.6", "3.8", "3.9"]
21712172
auth: "noauth"
21722173
ssl: "ssl"
21732174
pyopenssl: "*"
@@ -2177,6 +2178,19 @@ buildvariants:
21772178
# Test standalone and sharded only on 4.4.
21782179
- '.4.4'
21792180

2181+
- matrix_name: "tests-pyopenssl-pypy"
2182+
matrix_spec:
2183+
platform: debian92
2184+
python-version: ["pypy", "pypy3.5", "pypy3.6"]
2185+
auth: "auth"
2186+
ssl: "ssl"
2187+
pyopenssl: "*"
2188+
display_name: "PyOpenSSL ${platform} ${python-version} ${auth}"
2189+
tasks:
2190+
- '.replica_set !.2.6 !.3.0 !.3.2 !.3.4'
2191+
# Test standalone and sharded only on 4.4.
2192+
- '.4.4'
2193+
21802194
- matrix_name: "test-pyopenssl-old-py27"
21812195
matrix_spec:
21822196
platform:
@@ -2214,7 +2228,7 @@ buildvariants:
22142228
matrix_spec:
22152229
platform: rhel62
22162230
# RHEL 6.2 does not support Python 3.7.x and later.
2217-
python-version: ["2.7", "3.4", "3.5", "3.6", "pypy", "pypy3.5", "pypy3.6"]
2231+
python-version: ["2.7", "3.4", "3.5", "3.6"]
22182232
auth-ssl: noauth-nossl
22192233
# TODO: dependency error for 'coverage-report' task:
22202234
# dependency tests-python-version-rhel62-test-encryption_.../test-2.6-standalone is not present in the project config
@@ -2223,6 +2237,15 @@ buildvariants:
22232237
display_name: "Encryption ${python-version} ${platform} ${auth-ssl}"
22242238
tasks: *encryption-server-versions
22252239

2240+
- matrix_name: "tests-pypy-debian-test-encryption"
2241+
matrix_spec:
2242+
platform: debian92
2243+
python-version: ["pypy", "pypy3.5", "pypy3.6"]
2244+
auth-ssl: noauth-nossl
2245+
encryption: "*"
2246+
display_name: "Encryption ${python-version} ${platform} ${auth-ssl}"
2247+
tasks: *encryption-server-versions
2248+
22262249
- matrix_name: "tests-python-version-rhel62-without-c-extensions"
22272250
matrix_spec:
22282251
platform: rhel62
@@ -2365,12 +2388,6 @@ buildvariants:
23652388
python-version-windows: "*"
23662389
auth-ssl: "*"
23672390
encryption: "*"
2368-
exclude_spec:
2369-
# PYTHON-2366 Skip 3.9 due to cryptography install failures
2370-
- platform: "*"
2371-
python-version-windows: ["3.9"]
2372-
auth-ssl: "*"
2373-
encryption: "*"
23742391
display_name: "Encryption ${platform} ${python-version-windows} ${auth-ssl}"
23752392
tasks: *encryption-server-versions
23762393

@@ -2533,7 +2550,19 @@ buildvariants:
25332550
- matrix_name: "ocsp-test"
25342551
matrix_spec:
25352552
platform: ubuntu-16.04
2536-
python-version: ["2.7", "3.4", "3.8", "3.9", "pypy", "pypy3.5"]
2553+
python-version: ["2.7", "3.4", "3.8", "3.9"]
2554+
mongodb-version: ["4.4", "latest"]
2555+
auth: "noauth"
2556+
ssl: "ssl"
2557+
display_name: "OCSP test ${platform} ${python-version} ${mongodb-version}"
2558+
batchtime: 20160 # 14 days
2559+
tasks:
2560+
- name: ".ocsp"
2561+
2562+
- matrix_name: "ocsp-test-pypy"
2563+
matrix_spec:
2564+
platform: debian92
2565+
python-version: ["pypy", "pypy3.5", "pypy3.6"]
25372566
mongodb-version: ["4.4", "latest"]
25382567
auth: "noauth"
25392568
ssl: "ssl"
@@ -2545,7 +2574,7 @@ buildvariants:
25452574
- matrix_name: "ocsp-test-windows"
25462575
matrix_spec:
25472576
platform: windows-64-vsMulti-small
2548-
python-version-windows: ["2.7", "3.4", "3.8"]
2577+
python-version-windows: ["2.7", "3.4", "3.9"]
25492578
mongodb-version: ["4.4", "latest"]
25502579
auth: "noauth"
25512580
ssl: "ssl"

.evergreen/run-ocsp-tests.sh

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
set -o xtrace
44
set -o errexit
55

6+
# For createvirtualenv.
7+
. .evergreen/utils.sh
8+
69
if [ -z "$PYTHON_BINARY" ]; then
710
echo "No python binary specified"
811
PYTHON=$(command -v python || command -v python3) || true
@@ -14,36 +17,9 @@ else
1417
PYTHON="$PYTHON_BINARY"
1518
fi
1619

17-
if $PYTHON -m virtualenv --version; then
18-
VIRTUALENV="$PYTHON -m virtualenv"
19-
elif command -v virtualenv; then
20-
# We can remove this fallback after:
21-
# https://github.com/10gen/mongo-python-toolchain/issues/8
22-
VIRTUALENV="$(command -v virtualenv) -p $PYTHON"
23-
else
24-
echo "Cannot test without virtualenv"
25-
exit 1
26-
fi
27-
28-
$VIRTUALENV --never-download --no-wheel ocsptest
29-
if [ "Windows_NT" = "$OS" ]; then
30-
. ocsptest/Scripts/activate
31-
else
32-
. ocsptest/bin/activate
33-
fi
20+
createvirtualenv $PYTHON ocsptest
3421
trap "deactivate; rm -rf ocsptest" EXIT HUP
3522

36-
IS_PYTHON_2=$(python -c "import sys; sys.stdout.write('1' if sys.version_info < (3,) else '0')")
37-
if [ $IS_PYTHON_2 = "1" ]; then
38-
echo "Using a Python 2"
39-
# Upgrade pip to install the cryptography wheel and not the tar.
40-
# <20.1 because 20.0.2 says a future release may drop support for 2.7.
41-
python -m pip install --upgrade 'pip<20.1'
42-
# Upgrade setuptools because cryptography requires 18.5+.
43-
# <45 because 45.0 dropped support for 2.7.
44-
python -m pip install --upgrade 'setuptools<45'
45-
fi
46-
47-
python -m pip install pyopenssl requests service_identity
23+
python -m pip install --prefer-binary pyopenssl requests service_identity
4824

4925
OCSP_TLS_SHOULD_SUCCEED=${OCSP_TLS_SHOULD_SUCCEED} CA_FILE=${CA_FILE} python test/ocsp/test_ocsp.py

.evergreen/run-tests.sh

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -94,38 +94,11 @@ fi
9494

9595
# PyOpenSSL test setup.
9696
if [ -n "$TEST_PYOPENSSL" ]; then
97-
if $PYTHON -m virtualenv --version; then
98-
VIRTUALENV="$PYTHON -m virtualenv"
99-
elif command -v virtualenv; then
100-
# We can remove this fallback after:
101-
# https://github.com/10gen/mongo-python-toolchain/issues/8
102-
VIRTUALENV="$(command -v virtualenv) -p $PYTHON"
103-
else
104-
echo "Cannot test without virtualenv"
105-
exit 1
106-
fi
107-
108-
$VIRTUALENV pyopenssltest
109-
if [ "Windows_NT" = "$OS" ]; then
110-
. pyopenssltest/Scripts/activate
111-
else
112-
. pyopenssltest/bin/activate
113-
fi
97+
createvirtualenv $PYTHON pyopenssltest
11498
trap "deactivate; rm -rf pyopenssltest" EXIT HUP
11599
PYTHON=python
116100

117-
IS_PYTHON_2=$(python -c "import sys; sys.stdout.write('1' if sys.version_info < (3,) else '0')")
118-
if [ $IS_PYTHON_2 = "1" ]; then
119-
echo "Using a Python 2"
120-
# Upgrade pip to install the cryptography wheel and not the tar.
121-
# <20.1 because 20.0.2 says a future release may drop support for 2.7.
122-
python -m pip install --upgrade 'pip<20.1'
123-
# Upgrade setuptools because cryptography requires 18.5+.
124-
# <45 because 45.0 dropped support for 2.7.
125-
python -m pip install --upgrade 'setuptools<45'
126-
fi
127-
128-
python -m pip install pyopenssl requests service_identity
101+
python -m pip install --prefer-binary pyopenssl requests service_identity
129102
fi
130103

131104
if [ -n "$TEST_ENCRYPTION" ]; then
@@ -166,7 +139,8 @@ if [ -n "$TEST_ENCRYPTION" ]; then
166139

167140
# TODO: Test with 'pip install pymongocrypt'
168141
git clone --branch master https://github.com/mongodb/libmongocrypt.git libmongocrypt_git
169-
python -m pip install --upgrade ./libmongocrypt_git/bindings/python
142+
python -m pip install --prefer-binary -r .evergreen/test-encryption-requirements.txt
143+
python -m pip install ./libmongocrypt_git/bindings/python
170144
python -c "import pymongocrypt; print('pymongocrypt version: '+pymongocrypt.__version__)"
171145
python -c "import pymongocrypt; print('libmongocrypt version: '+pymongocrypt.libmongocrypt_version())"
172146
# PATH is updated by PREPARE_SHELL for access to mongocryptd.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# cffi==1.14.3 was the last installable release on RHEL 6.2 with Python 3.4
2+
cffi==1.14.3;python_version=="3.4"
3+
cffi>=1.12.0,<2;python_version!="3.4"
4+
cryptography>=2,<4

.evergreen/utils.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,24 @@ createvirtualenv () {
88
PYTHON=$1
99
VENVPATH=$2
1010
if $PYTHON -m virtualenv --version; then
11-
VIRTUALENV="$PYTHON -m virtualenv"
11+
VIRTUALENV="$PYTHON -m virtualenv --never-download"
12+
elif $PYTHON -m venv -h>/dev/null; then
13+
VIRTUALENV="$PYTHON -m venv"
1214
elif command -v virtualenv; then
13-
VIRTUALENV="$(command -v virtualenv) -p $PYTHON"
15+
VIRTUALENV="$(command -v virtualenv) -p $PYTHON --never-download"
1416
else
1517
echo "Cannot test without virtualenv"
1618
exit 1
1719
fi
18-
$VIRTUALENV --system-site-packages --never-download $VENVPATH
20+
$VIRTUALENV $VENVPATH
1921
if [ "Windows_NT" = "$OS" ]; then
2022
. $VENVPATH/Scripts/activate
2123
else
2224
. $VENVPATH/bin/activate
2325
fi
26+
# Upgrade to the latest versions of pip setuptools wheel so that
27+
# pip can always download the latest cryptography+cffi wheels.
28+
python -m pip install --upgrade pip setuptools wheel
2429
}
2530

2631
# Usage:

0 commit comments

Comments
 (0)