Skip to content

Commit fb4c20a

Browse files
committed
PYTHON-2133 - Stop testing Python 2.7 on Evergreen
1 parent 06924cb commit fb4c20a

11 files changed

+69
-245
lines changed

.evergreen/config.yml

Lines changed: 28 additions & 120 deletions
Large diffs are not rendered by default.

.evergreen/run-atlas-tests.sh

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,22 @@
44
set -o errexit
55
set -o xtrace
66

7-
export JAVA_HOME=/opt/java/jdk8
8-
97
if [ -z "$PYTHON_BINARY" ]; then
108
echo "No python binary specified"
11-
PYTHON_BINARY=$(command -v python || command -v python3) || true
9+
PYTHON_BINARY=$(command -v python3) || true
1210
if [ -z "$PYTHON_BINARY" ]; then
13-
echo "Cannot test without python or python3 installed!"
11+
echo "Cannot test without python3 installed!"
1412
exit 1
1513
fi
1614
fi
1715

18-
IMPL=$(${PYTHON_BINARY} -c "import platform, sys; sys.stdout.write(platform.python_implementation())")
19-
20-
if [ $IMPL = "Jython" ]; then
21-
# The venv created by createvirtualenv is incompatible with Jython
22-
$PYTHON_BINARY -m virtualenv --never-download --no-wheel atlastest
23-
. atlastest/bin/activate
24-
else
25-
# All other pythons work with createvirtualenv.
26-
. .evergreen/utils.sh
27-
createvirtualenv $PYTHON_BINARY atlastest
28-
fi
16+
. .evergreen/utils.sh
17+
createvirtualenv $PYTHON_BINARY atlastest
2918
trap "deactivate; rm -rf atlastest" EXIT HUP
3019

31-
if [ $IMPL = "Jython" -o $IMPL = "PyPy" ]; then
32-
echo "Using Jython or PyPy"
33-
python -m pip install certifi
34-
else
35-
IS_PRE_279=$(python -c "import sys; sys.stdout.write('1' if sys.version_info < (2, 7, 9) else '0')")
36-
if [ $IS_PRE_279 = "1" ]; then
37-
echo "Using a Pre-2.7.9 CPython"
38-
python -m pip install pyopenssl>=17.2.0 service_identity>18.1.0
39-
else
40-
echo "Using CPython 2.7.9+"
41-
fi
42-
fi
43-
4420
echo "Running tests without dnspython"
4521
python test/atlas/test_connection.py
4622

47-
# dnspython is incompatible with Jython so don't test that combination.
48-
if [ $IMPL != "Jython" ]; then
49-
python -m pip install dnspython
50-
echo "Running tests with dnspython"
51-
MUST_TEST_SRV="1" python test/atlas/test_connection.py
52-
fi
23+
python -m pip install dnspython
24+
echo "Running tests with dnspython"
25+
MUST_TEST_SRV="1" python test/atlas/test_connection.py

.evergreen/run-cdecimal-tests.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

.evergreen/run-enterprise-auth-tests.sh

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,28 @@ set -o errexit
55

66
echo "Running enterprise authentication tests"
77

8-
export JAVA_HOME=/opt/java/jdk8
9-
10-
PLATFORM="$(${PYTHON_BINARY} -c 'import platform, sys; sys.stdout.write(platform.system())')"
11-
128
export DB_USER="bob"
139
export DB_PASSWORD="pwd123"
14-
EXTRA_ARGS=""
15-
16-
# There is no kerberos package for Jython, but we do want to test PLAIN.
17-
if [ ${PLATFORM} != "Java" ]; then
18-
if [ "Windows_NT" = "$OS" ]; then
19-
echo "Setting GSSAPI_PASS"
20-
export GSSAPI_PASS=${SASL_PASS}
21-
export GSSAPI_CANONICALIZE="true"
22-
else
23-
# BUILD-3830
24-
touch ${PROJECT_DIRECTORY}/.evergreen/krb5.conf.empty
25-
export KRB5_CONFIG=${PROJECT_DIRECTORY}/.evergreen/krb5.conf.empty
26-
27-
echo "Writing keytab"
28-
echo ${KEYTAB_BASE64} | base64 -d > ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab
29-
echo "Running kinit"
30-
kinit -k -t ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab -p ${PRINCIPAL}
31-
fi
32-
echo "Setting GSSAPI variables"
33-
export GSSAPI_HOST=${SASL_HOST}
34-
export GSSAPI_PORT=${SASL_PORT}
35-
export GSSAPI_PRINCIPAL=${PRINCIPAL}
10+
if [ "Windows_NT" = "$OS" ]; then
11+
echo "Setting GSSAPI_PASS"
12+
export GSSAPI_PASS=${SASL_PASS}
13+
export GSSAPI_CANONICALIZE="true"
3614
else
37-
EXTRA_ARGS="-J-XX:-UseGCOverheadLimit -J-Xmx4096m"
15+
# BUILD-3830
16+
touch ${PROJECT_DIRECTORY}/.evergreen/krb5.conf.empty
17+
export KRB5_CONFIG=${PROJECT_DIRECTORY}/.evergreen/krb5.conf.empty
18+
19+
echo "Writing keytab"
20+
echo ${KEYTAB_BASE64} | base64 -d > ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab
21+
echo "Running kinit"
22+
kinit -k -t ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab -p ${PRINCIPAL}
3823
fi
24+
echo "Setting GSSAPI variables"
25+
export GSSAPI_HOST=${SASL_HOST}
26+
export GSSAPI_PORT=${SASL_PORT}
27+
export GSSAPI_PRINCIPAL=${PRINCIPAL}
3928

4029

4130
echo "Running tests"
4231
${PYTHON_BINARY} setup.py clean
43-
${PYTHON_BINARY} $EXTRA_ARGS setup.py test --xunit-output=xunit-results
32+
${PYTHON_BINARY} setup.py test --xunit-output=xunit-results

.evergreen/run-mongodb-aws-ecs-test.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ authtest () {
3333
echo "Running MONGODB-AWS ECS authentication tests with $PYTHON"
3434
$PYTHON --version
3535

36-
$VIRTUALENV -p $PYTHON --system-site-packages --never-download venvaws
36+
$VIRTUALENV -p $PYTHON --never-download venvaws
3737
. venvaws/bin/activate
3838

3939
cd src
@@ -44,5 +44,4 @@ authtest () {
4444
rm -rf venvaws
4545
}
4646

47-
PYTHON=$(command -v python) authtest
4847
PYTHON=$(command -v python3) authtest

.evergreen/run-mongodb-aws-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ authtest () {
5454
echo "Running MONGODB-AWS authentication tests with $PYTHON"
5555
$PYTHON --version
5656

57-
$VIRTUALENV -p $PYTHON --system-site-packages --never-download venvaws
57+
$VIRTUALENV -p $PYTHON --never-download venvaws
5858
if [ "Windows_NT" = "$OS" ]; then
5959
. venvaws/Scripts/activate
6060
else

.evergreen/run-ocsp-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ set -o errexit
88

99
if [ -z "$PYTHON_BINARY" ]; then
1010
echo "No python binary specified"
11-
PYTHON=$(command -v python || command -v python3) || true
11+
PYTHON=$(command -v python3) || true
1212
if [ -z "$PYTHON" ]; then
13-
echo "Cannot test without python or python3 installed!"
13+
echo "Cannot test without python3 installed!"
1414
exit 1
1515
fi
1616
else

.evergreen/run-perf-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export TEST_PATH="${PROJECT_DIRECTORY}/driver-performance-test-data"
1414
export OUTPUT_FILE="${PROJECT_DIRECTORY}/results.json"
1515

1616
MTCBIN=/opt/mongodbtoolchain/v2/bin
17-
VIRTUALENV="$MTCBIN/virtualenv -p $MTCBIN/python2.7"
17+
VIRTUALENV="$MTCBIN/virtualenv -p $MTCBIN/python3"
1818

1919
$VIRTUALENV pyperftest
2020
. pyperftest/bin/activate

.evergreen/run-tests.sh

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ set -o errexit # Exit the script with error if any of the commands fail
1111
# COVERAGE If non-empty, run the test suite with coverage.
1212
# TEST_ENCRYPTION If non-empty, install pymongocrypt.
1313
# LIBMONGOCRYPT_URL The URL to download libmongocrypt.
14-
# SETDEFAULTENCODING The encoding to set via sys.setdefaultencoding.
1514

1615
if [ -n "${SET_XTRACE_ON}" ]; then
1716
set -o xtrace
@@ -29,7 +28,6 @@ COMPRESSORS=${COMPRESSORS:-}
2928
MONGODB_API_VERSION=${MONGODB_API_VERSION:-}
3029
TEST_ENCRYPTION=${TEST_ENCRYPTION:-}
3130
LIBMONGOCRYPT_URL=${LIBMONGOCRYPT_URL:-}
32-
SETDEFAULTENCODING=${SETDEFAULTENCODING:-}
3331
DATA_LAKE=${DATA_LAKE:-}
3432

3533
if [ -n "$COMPRESSORS" ]; then
@@ -40,9 +38,6 @@ if [ -n "$MONGODB_API_VERSION" ]; then
4038
export MONGODB_API_VERSION=$MONGODB_API_VERSION
4139
fi
4240

43-
44-
export JAVA_HOME=/opt/java/jdk8
45-
4641
if [ "$AUTH" != "noauth" ]; then
4742
if [ -z "$DATA_LAKE" ]; then
4843
export DB_USER="bob"
@@ -62,43 +57,26 @@ fi
6257
. .evergreen/utils.sh
6358

6459
if [ -z "$PYTHON_BINARY" ]; then
65-
VIRTUALENV=$(command -v virtualenv) || true
66-
if [ -z "$VIRTUALENV" ]; then
67-
PYTHON=$(command -v python || command -v python3) || true
68-
if [ -z "$PYTHON" ]; then
69-
echo "Cannot test without python or python3 installed!"
70-
exit 1
71-
fi
72-
else
73-
$VIRTUALENV pymongotestvenv
74-
. pymongotestvenv/bin/activate
75-
PYTHON=python
76-
trap "deactivate; rm -rf pymongotestvenv" EXIT HUP
60+
# Use Python 3 from the server toolchain to test on ARM, POWER or zSeries if a
61+
# system python3 doesn't exist. This seems to only be an issue on RHEL 7.x.
62+
PYTHON=$(command -v python3 || command -v /opt/mongodbtoolchain/v2/bin/python3) || true
63+
if [ -z "$PYTHON" ]; then
64+
echo "Cannot test without python3 installed!"
65+
exit 1
7766
fi
7867
elif [ "$COMPRESSORS" = "snappy" ]; then
79-
$PYTHON_BINARY -m virtualenv --system-site-packages --never-download snappytest
68+
$PYTHON_BINARY -m virtualenv --never-download snappytest
8069
. snappytest/bin/activate
8170
trap "deactivate; rm -rf snappytest" EXIT HUP
8271
# 0.5.2 has issues in pypy3(.5)
8372
pip install python-snappy==0.5.1
8473
PYTHON=python
8574
elif [ "$COMPRESSORS" = "zstd" ]; then
86-
$PYTHON_BINARY -m virtualenv --system-site-packages --never-download zstdtest
75+
$PYTHON_BINARY -m virtualenv --never-download zstdtest
8776
. zstdtest/bin/activate
8877
trap "deactivate; rm -rf zstdtest" EXIT HUP
8978
pip install zstandard
9079
PYTHON=python
91-
elif [ -n "$SETDEFAULTENCODING" ]; then
92-
$PYTHON_BINARY -m virtualenv --system-site-packages --never-download encodingtest
93-
. encodingtest/bin/activate
94-
trap "deactivate; rm -rf encodingtest" EXIT HUP
95-
mkdir test-sitecustomize
96-
cat <<EOT > test-sitecustomize/sitecustomize.py
97-
import sys
98-
sys.setdefaultencoding("$SETDEFAULTENCODING")
99-
EOT
100-
export PYTHONPATH="$(pwd)/test-sitecustomize"
101-
PYTHON=python
10280
else
10381
PYTHON="$PYTHON_BINARY"
10482
fi
@@ -158,13 +136,6 @@ if [ -n "$TEST_ENCRYPTION" ]; then
158136

159137
fi
160138

161-
PYTHON_IMPL=$($PYTHON -c "import platform, sys; sys.stdout.write(platform.python_implementation())")
162-
if [ $PYTHON_IMPL = "Jython" ]; then
163-
PYTHON_ARGS="-J-XX:-UseGCOverheadLimit -J-Xmx4096m"
164-
else
165-
PYTHON_ARGS=""
166-
fi
167-
168139
if [ -z "$DATA_LAKE" ]; then
169140
TEST_ARGS=""
170141
else
@@ -217,7 +188,7 @@ if [ -z "$GREEN_FRAMEWORK" ]; then
217188
# causing this script to exit.
218189
$PYTHON -c "from bson import _cbson; from pymongo import _cmessage"
219190
fi
220-
$COVERAGE_OR_PYTHON $PYTHON_ARGS $COVERAGE_ARGS setup.py $C_EXTENSIONS test $TEST_ARGS $OUTPUT
191+
$COVERAGE_OR_PYTHON $COVERAGE_ARGS setup.py $C_EXTENSIONS test $TEST_ARGS $OUTPUT
221192
else
222193
# --no_ext has to come before "test" so there is no way to toggle extensions here.
223194
$PYTHON green_framework_test.py $GREEN_FRAMEWORK $OUTPUT

.evergreen/utils.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ createvirtualenv () {
1010
if $PYTHON -m virtualenv --version; then
1111
VIRTUALENV="$PYTHON -m virtualenv --never-download"
1212
elif $PYTHON -m venv -h>/dev/null; then
13+
# System virtualenv might not be compatible with the python3 on our path
1314
VIRTUALENV="$PYTHON -m venv"
14-
elif command -v virtualenv; then
15-
VIRTUALENV="$(command -v virtualenv) -p $PYTHON --never-download"
1615
else
1716
echo "Cannot test without virtualenv"
1817
exit 1

test/test_ssl.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,12 @@
5151
import OpenSSL
5252
import requests
5353
import service_identity
54+
from pymongo.ocsp_support import _load_trusted_ca_certs
5455
_HAVE_PYOPENSSL = True
5556
except ImportError:
56-
pass
57-
58-
if _HAVE_PYOPENSSL:
59-
from pymongo.ocsp_support import _load_trusted_ca_certs
60-
else:
6157
_load_trusted_ca_certs = None
6258

59+
6360
if HAVE_SSL:
6461
import ssl
6562

0 commit comments

Comments
 (0)