PYTHON-2133 - Stop testing Python 2.7 on Evergreen

This commit is contained in:
Bernie Hackett 2020-11-20 12:02:40 -08:00
parent 06924cb00b
commit fb4c20adfa
11 changed files with 69 additions and 245 deletions

View File

@ -514,7 +514,7 @@ functions:
silent: true
script: |
cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
alias urlencode='python -c "import sys, urllib as ul; sys.stdout.write(ul.quote_plus(sys.argv[1]))"'
alias urlencode='python3 -c "import sys, urllib.parse as ulp; sys.stdout.write(ulp.quote_plus(sys.argv[1]))"'
USER=$(urlencode ${iam_auth_ecs_account})
PASS=$(urlencode ${iam_auth_ecs_secret_access_key})
MONGODB_URI="mongodb://$USER:$PASS@localhost"
@ -552,8 +552,8 @@ functions:
script: |
# DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)
cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
alias urlencode='python -c "import sys, urllib as ul; sys.stdout.write(ul.quote_plus(sys.argv[1]))"'
alias jsonkey='python -c "import json,sys;sys.stdout.write(json.load(sys.stdin)[sys.argv[1]])" < ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json'
alias urlencode='python3 -c "import sys, urllib.parse as ulp; sys.stdout.write(ulp.quote_plus(sys.argv[1]))"'
alias jsonkey='python3 -c "import json,sys;sys.stdout.write(json.load(sys.stdin)[sys.argv[1]])" < ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json'
USER=$(jsonkey AccessKeyId)
USER=$(urlencode $USER)
PASS=$(jsonkey SecretAccessKey)
@ -626,7 +626,7 @@ functions:
script: |
# DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)
cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
alias jsonkey='python -c "import json,sys;sys.stdout.write(json.load(sys.stdin)[sys.argv[1]])" < ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json'
alias jsonkey='python3 -c "import json,sys;sys.stdout.write(json.load(sys.stdin)[sys.argv[1]])" < ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json'
export AWS_ACCESS_KEY_ID=$(jsonkey AccessKeyId)
export AWS_SECRET_ACCESS_KEY=$(jsonkey SecretAccessKey)
export AWS_SESSION_TOKEN=$(jsonkey SessionToken)
@ -1193,7 +1193,7 @@ tasks:
commands:
- func: "run tests"
vars:
PYTHON_BINARY: /opt/python/2.7/bin/python
PYTHON_BINARY: /opt/python/3.6/bin/python3
- name: "atlas-connect"
tags: ["atlas-connect"]
@ -1799,10 +1799,6 @@ axes:
values:
# Note: always display platform with python-version to avoid ambiguous display names.
# Linux
- id: "2.7"
display_name: "Python 2.7"
variables:
PYTHON_BINARY: "/opt/python/2.7/bin/python"
- id: "3.4"
display_name: "Python 3.4"
variables:
@ -1828,10 +1824,6 @@ axes:
display_name: "Python 3.9"
variables:
PYTHON_BINARY: "/opt/python/3.9/bin/python3"
- id: "pypy"
display_name: "PyPy"
variables:
PYTHON_BINARY: "/opt/python/pypy/bin/pypy"
- id: "pypy3.5"
display_name: "PyPy 3.5"
variables:
@ -1840,16 +1832,6 @@ axes:
display_name: "PyPy 3.6"
variables:
PYTHON_BINARY: "/opt/python/pypy3.6/bin/pypy3"
- id: "jython2.7"
display_name: "Jython 2.7"
batchtime: 10080 # 7 days
variables:
PYTHON_BINARY: "/opt/python/jython2.7/bin/jython"
# System python
- id: "system-python"
display_name: "Python"
variables:
PYTHON_BINARY: "python"
- id: "system-python3"
display_name: "Python3"
variables:
@ -1858,10 +1840,6 @@ axes:
- id: python-version-windows
display_name: "Python"
values:
- id: "2.7"
display_name: "Python 2.7"
variables:
PYTHON_BINARY: "C:/python/Python27/python.exe"
- id: "3.4"
display_name: "Python 3.4"
variables:
@ -1890,10 +1868,6 @@ axes:
- id: python-version-windows-32
display_name: "Python"
values:
- id: "2.7"
display_name: "32-bit Python 2.7"
variables:
PYTHON_BINARY: "C:/python/32/Python27/python.exe"
- id: "3.4"
display_name: "32-bit Python 3.4"
variables:
@ -2015,16 +1989,6 @@ axes:
test_pyopenssl: true
batchtime: 10080 # 7 days
# Run setdefaultencoding before running the test suite?
- id: setdefaultencoding
display_name: "setdefaultencoding"
values:
- id: "setdefaultencoding"
display_name: "setdefaultencoding"
tags: ["setdefaultencoding_tag"]
variables:
SETDEFAULTENCODING: "cp1251"
- id: requireApiVersion
display_name: "requireApiVersion"
values:
@ -2044,7 +2008,6 @@ buildvariants:
platform:
# OSes that support versions of MongoDB>=2.6 with SSL.
- awslinux
- rhel70
auth-ssl: "*"
display_name: "${platform} ${auth-ssl}"
tasks: &all-server-versions
@ -2063,7 +2026,6 @@ buildvariants:
platform:
# OSes that support versions of MongoDB>=2.6 with SSL.
- awslinux
- rhel70
auth-ssl: "*"
encryption: "*"
display_name: "Encryption ${platform} ${auth-ssl}"
@ -2196,7 +2158,7 @@ buildvariants:
matrix_spec:
platform: rhel62
# RHEL 6.2 does not support Python 3.7.x and later.
python-version: &rhel62-pythons ["2.7", "3.4", "3.5", "3.6", "pypy", "pypy3.5", "pypy3.6", "jython2.7"]
python-version: &rhel62-pythons ["3.4", "3.5", "3.6", "pypy3.5", "pypy3.6"]
auth: "*"
ssl: "*"
coverage: "*"
@ -2206,32 +2168,20 @@ buildvariants:
auth: "noauth"
ssl: "ssl"
coverage: "*"
- platform: rhel62
python-version: "!jython2.7" # Test Jython with Auth/NoSSL
auth: "auth"
ssl: "nossl"
coverage: "*"
- platform: rhel62
# PYTHON-498: disable Jython SSL tests
python-version: "jython2.7"
# EVG-1410: exlcude_spec must specifiy values for all axes
auth: "*"
ssl: "ssl"
coverage: "*"
display_name: "${python-version} ${platform} ${auth} ${ssl} ${coverage}"
tasks: *all-server-versions
- matrix_name: "tests-pyopenssl"
matrix_spec:
platform: ubuntu-16.04
python-version: ["2.7", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9"]
python-version: ["3.4", "3.5", "3.6", "3.7", "3.8", "3.9"]
auth: "*"
ssl: "ssl"
pyopenssl: "*"
# Only test "noauth" with Python 3.7.
exclude_spec:
platform: ubuntu-16.04
python-version: ["2.7", "3.4", "3.5", "3.6", "3.8", "3.9"]
python-version: ["3.4", "3.5", "3.6", "3.8", "3.9"]
auth: "noauth"
ssl: "ssl"
pyopenssl: "*"
@ -2244,7 +2194,7 @@ buildvariants:
- matrix_name: "tests-pyopenssl-pypy"
matrix_spec:
platform: debian92
python-version: ["pypy", "pypy3.5", "pypy3.6"]
python-version: ["pypy3.5", "pypy3.6"]
auth: "auth"
ssl: "ssl"
pyopenssl: "*"
@ -2254,18 +2204,6 @@ buildvariants:
# Test standalone and sharded only on 4.4.
- '.4.4'
- matrix_name: "test-pyopenssl-old-py27"
matrix_spec:
platform:
# Supported OSes with pre-2.7.9 CPython versions.
- rhel70 # CPython 2.7.5
auth: "auth"
ssl: "ssl"
pyopenssl: "*"
display_name: "PyOpenSSL ${platform} Pre-2.7.9 Python ${auth}"
tasks:
- '.replica_set'
- matrix_name: "tests-pyopenssl-macOS"
matrix_spec:
platform: macos-1014
@ -2291,7 +2229,7 @@ buildvariants:
matrix_spec:
platform: rhel62
# RHEL 6.2 does not support Python 3.7.x and later.
python-version: ["2.7", "3.4", "3.5", "3.6"]
python-version: ["3.4", "3.5", "3.6"]
auth-ssl: noauth-nossl
# TODO: dependency error for 'coverage-report' task:
# dependency tests-python-version-rhel62-test-encryption_.../test-2.6-standalone is not present in the project config
@ -2303,7 +2241,7 @@ buildvariants:
- matrix_name: "tests-pypy-debian-test-encryption"
matrix_spec:
platform: debian92
python-version: ["pypy", "pypy3.5", "pypy3.6"]
python-version: ["pypy3.5", "pypy3.6"]
auth-ssl: noauth-nossl
encryption: "*"
display_name: "Encryption ${python-version} ${platform} ${auth-ssl}"
@ -2319,7 +2257,7 @@ buildvariants:
exclude_spec:
# These interpreters are always tested without extensions.
- platform: rhel62
python-version: ["pypy", "pypy3.5", "pypy3.6", "jython2.7"]
python-version: ["pypy3.5", "pypy3.6"]
c-extensions: "*"
auth-ssl: "*"
coverage: "*"
@ -2346,20 +2284,15 @@ buildvariants:
matrix_spec:
# Ubuntu 16.04 images have libsnappy-dev installed, and provides OpenSSL 1.0.2 for testing Python 3.7
platform: ubuntu-16.04
python-version: ["2.7", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "pypy", "pypy3.5", "pypy3.6", "jython2.7"]
python-version: ["3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "pypy3.5", "pypy3.6"]
c-extensions: "*"
compression: "*"
exclude_spec:
# These interpreters are always tested without extensions.
- platform: ubuntu-16.04
python-version: ["pypy", "pypy3.5", "pypy3.6", "jython2.7"]
python-version: ["pypy3.5", "pypy3.6"]
c-extensions: "with-c-extensions"
compression: "*"
# Jython doesn't support some compression types.
- platform: ubuntu-16.04
python-version: ["jython2.7"]
c-extensions: "*"
compression: ["snappy", "zstd"]
# PYTHON-2365 Some tests fail with CPython 3.8+ and python-snappy
- platform: ubuntu-16.04
python-version: ["3.8", "3.9"]
@ -2390,7 +2323,7 @@ buildvariants:
exclude_spec:
# Don't test green frameworks on these Python versions.
- platform: rhel62
python-version: ["pypy", "pypy3.5", "pypy3.6", "jython2.7"]
python-version: ["pypy3.5", "pypy3.6"]
green-framework: "*"
auth-ssl: "*"
display_name: "${green-framework} ${python-version} ${platform} ${auth-ssl}"
@ -2454,12 +2387,12 @@ buildvariants:
display_name: "Encryption ${platform} ${python-version-windows} ${auth-ssl}"
tasks: *encryption-server-versions
# Storage engine tests on RHEL 6.2 (x86_64) with Python 2.7.
# Storage engine tests on RHEL 6.2 (x86_64) with Python 3.6.
- matrix_name: "tests-storage-engines"
matrix_spec:
platform: rhel62
storage-engine: "*"
python-version: 2.7
python-version: 3.6
display_name: "Storage ${storage-engine} ${python-version} ${platform}"
rules:
- if:
@ -2497,26 +2430,16 @@ buildvariants:
add_tasks:
- "test-3.0-standalone"
# enableTestCommands=0 tests on RHEL 6.2 (x86_64) with Python 2.7.
# enableTestCommands=0 tests on RHEL 6.2 (x86_64) with Python 3.6.
- matrix_name: "test-disableTestCommands"
matrix_spec:
platform: rhel62
disableTestCommands: "*"
python-version: "2.7"
python-version: "3.6"
display_name: "Disable test commands ${python-version} ${platform}"
tasks:
- ".latest"
# setdefaultencoding tests on RHEL 6.2 (x86_64) with Python 2.7.
- matrix_name: "test-setdefaultencoding"
matrix_spec:
platform: rhel62
setdefaultencoding: "*"
python-version: "2.7"
display_name: "setdefaultencoding ${python-version} ${platform}"
tasks:
- "test-latest-standalone"
- matrix_name: "test-linux-enterprise-auth"
matrix_spec:
platform: rhel62
@ -2538,7 +2461,7 @@ buildvariants:
- matrix_name: "tests-mod-wsgi"
matrix_spec:
platform: rhel62
python-version: ["2.7", "3.4", "3.6"]
python-version: ["3.4", "3.6"]
mod-wsgi-version: "*"
display_name: "${mod-wsgi-version} ${python-version} ${platform}"
tasks:
@ -2548,7 +2471,7 @@ buildvariants:
- matrix_name: "mockupdb-tests"
matrix_spec:
platform: rhel62
python-version: 2.7
python-version: 3.6
display_name: "MockupDB Tests"
tasks:
- name: "mockupdb"
@ -2556,19 +2479,11 @@ buildvariants:
- matrix_name: "tests-doctests"
matrix_spec:
platform: rhel62
python-version: ["2.7", "3.4"]
python-version: ["3.4"]
display_name: "Doctests ${python-version} ${platform}"
tasks:
- name: "doctests"
- matrix_name: "cdecimal"
matrix_spec:
platform: rhel62
python-version: 2.7
display_name: "cdecimal ${python-version} ${platform}"
tasks:
- name: "cdecimal"
- name: "no-server"
display_name: "No server test"
run_on:
@ -2587,13 +2502,6 @@ buildvariants:
expansions:
set_xtrace_on: on
- matrix_name: "atlas-connect-pre-279"
matrix_spec:
platform: rhel70
display_name: "Atlas connect Pre-2.7.9 Python ${platform}"
tasks:
- name: "atlas-connect"
- matrix_name: "atlas-connect"
matrix_spec:
platform: rhel62
@ -2613,7 +2521,7 @@ buildvariants:
- matrix_name: "data-lake-spec-tests"
matrix_spec:
platform: ubuntu-16.04
python-version: ["2.7", "3.4", "3.8"]
python-version: ["3.4", "3.8"]
auth: "auth"
c-extensions: "*"
display_name: "Atlas Data Lake ${python-version} ${c-extensions}"
@ -2623,7 +2531,7 @@ buildvariants:
- matrix_name: "versioned-api-tests"
matrix_spec:
platform: ubuntu-16.04
python-version: ["2.7", "3.9"]
python-version: ["3.6", "3.9"]
auth: "auth"
requireApiVersion: "*"
display_name: "requireApiVersion ${python-version}"
@ -2634,7 +2542,7 @@ buildvariants:
- matrix_name: "ocsp-test"
matrix_spec:
platform: ubuntu-16.04
python-version: ["2.7", "3.4", "3.8", "3.9"]
python-version: ["3.4", "3.8", "3.9"]
mongodb-version: ["4.4", "latest"]
auth: "noauth"
ssl: "ssl"
@ -2646,7 +2554,7 @@ buildvariants:
- matrix_name: "ocsp-test-pypy"
matrix_spec:
platform: debian92
python-version: ["pypy", "pypy3.5", "pypy3.6"]
python-version: ["pypy3.5", "pypy3.6"]
mongodb-version: ["4.4", "latest"]
auth: "noauth"
ssl: "ssl"
@ -2658,7 +2566,7 @@ buildvariants:
- matrix_name: "ocsp-test-windows"
matrix_spec:
platform: windows-64-vsMulti-small
python-version-windows: ["2.7", "3.4", "3.9"]
python-version-windows: ["3.4", "3.9"]
mongodb-version: ["4.4", "latest"]
auth: "noauth"
ssl: "ssl"
@ -2683,7 +2591,7 @@ buildvariants:
- matrix_name: "aws-auth-test"
matrix_spec:
platform: [ubuntu-18.04, macos-1014]
python-version: ["system-python", "system-python3"]
python-version: ["system-python3"]
display_name: "MONGODB-AWS Auth ${platform} ${python-version}"
tasks:
- name: "aws-auth-test-4.4"

View File

@ -4,49 +4,22 @@
set -o errexit
set -o xtrace
export JAVA_HOME=/opt/java/jdk8
if [ -z "$PYTHON_BINARY" ]; then
echo "No python binary specified"
PYTHON_BINARY=$(command -v python || command -v python3) || true
PYTHON_BINARY=$(command -v python3) || true
if [ -z "$PYTHON_BINARY" ]; then
echo "Cannot test without python or python3 installed!"
echo "Cannot test without python3 installed!"
exit 1
fi
fi
IMPL=$(${PYTHON_BINARY} -c "import platform, sys; sys.stdout.write(platform.python_implementation())")
if [ $IMPL = "Jython" ]; then
# The venv created by createvirtualenv is incompatible with Jython
$PYTHON_BINARY -m virtualenv --never-download --no-wheel atlastest
. atlastest/bin/activate
else
# All other pythons work with createvirtualenv.
. .evergreen/utils.sh
createvirtualenv $PYTHON_BINARY atlastest
fi
. .evergreen/utils.sh
createvirtualenv $PYTHON_BINARY atlastest
trap "deactivate; rm -rf atlastest" EXIT HUP
if [ $IMPL = "Jython" -o $IMPL = "PyPy" ]; then
echo "Using Jython or PyPy"
python -m pip install certifi
else
IS_PRE_279=$(python -c "import sys; sys.stdout.write('1' if sys.version_info < (2, 7, 9) else '0')")
if [ $IS_PRE_279 = "1" ]; then
echo "Using a Pre-2.7.9 CPython"
python -m pip install pyopenssl>=17.2.0 service_identity>18.1.0
else
echo "Using CPython 2.7.9+"
fi
fi
echo "Running tests without dnspython"
python test/atlas/test_connection.py
# dnspython is incompatible with Jython so don't test that combination.
if [ $IMPL != "Jython" ]; then
python -m pip install dnspython
echo "Running tests with dnspython"
MUST_TEST_SRV="1" python test/atlas/test_connection.py
fi
python -m pip install dnspython
echo "Running tests with dnspython"
MUST_TEST_SRV="1" python test/atlas/test_connection.py

View File

@ -1,12 +0,0 @@
#!/bin/bash
set -o xtrace
set -o errexit
virtualenv -p ${PYTHON_BINARY} cdecimaltest
trap "deactivate; rm -rf cdecimaltest" EXIT HUP
. cdecimaltest/bin/activate
# No cdecimal tarballs on pypi.
pip install http://www.bytereef.org/software/mpdecimal/releases/cdecimal-2.3.tar.gz
python -c 'import sys; print(sys.version)'
python cdecimal_test.py

View File

@ -5,39 +5,28 @@ set -o errexit
echo "Running enterprise authentication tests"
export JAVA_HOME=/opt/java/jdk8
PLATFORM="$(${PYTHON_BINARY} -c 'import platform, sys; sys.stdout.write(platform.system())')"
export DB_USER="bob"
export DB_PASSWORD="pwd123"
EXTRA_ARGS=""
# There is no kerberos package for Jython, but we do want to test PLAIN.
if [ ${PLATFORM} != "Java" ]; then
if [ "Windows_NT" = "$OS" ]; then
echo "Setting GSSAPI_PASS"
export GSSAPI_PASS=${SASL_PASS}
export GSSAPI_CANONICALIZE="true"
else
# BUILD-3830
touch ${PROJECT_DIRECTORY}/.evergreen/krb5.conf.empty
export KRB5_CONFIG=${PROJECT_DIRECTORY}/.evergreen/krb5.conf.empty
echo "Writing keytab"
echo ${KEYTAB_BASE64} | base64 -d > ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab
echo "Running kinit"
kinit -k -t ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab -p ${PRINCIPAL}
fi
echo "Setting GSSAPI variables"
export GSSAPI_HOST=${SASL_HOST}
export GSSAPI_PORT=${SASL_PORT}
export GSSAPI_PRINCIPAL=${PRINCIPAL}
if [ "Windows_NT" = "$OS" ]; then
echo "Setting GSSAPI_PASS"
export GSSAPI_PASS=${SASL_PASS}
export GSSAPI_CANONICALIZE="true"
else
EXTRA_ARGS="-J-XX:-UseGCOverheadLimit -J-Xmx4096m"
# BUILD-3830
touch ${PROJECT_DIRECTORY}/.evergreen/krb5.conf.empty
export KRB5_CONFIG=${PROJECT_DIRECTORY}/.evergreen/krb5.conf.empty
echo "Writing keytab"
echo ${KEYTAB_BASE64} | base64 -d > ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab
echo "Running kinit"
kinit -k -t ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab -p ${PRINCIPAL}
fi
echo "Setting GSSAPI variables"
export GSSAPI_HOST=${SASL_HOST}
export GSSAPI_PORT=${SASL_PORT}
export GSSAPI_PRINCIPAL=${PRINCIPAL}
echo "Running tests"
${PYTHON_BINARY} setup.py clean
${PYTHON_BINARY} $EXTRA_ARGS setup.py test --xunit-output=xunit-results
${PYTHON_BINARY} setup.py test --xunit-output=xunit-results

View File

@ -33,7 +33,7 @@ authtest () {
echo "Running MONGODB-AWS ECS authentication tests with $PYTHON"
$PYTHON --version
$VIRTUALENV -p $PYTHON --system-site-packages --never-download venvaws
$VIRTUALENV -p $PYTHON --never-download venvaws
. venvaws/bin/activate
cd src
@ -44,5 +44,4 @@ authtest () {
rm -rf venvaws
}
PYTHON=$(command -v python) authtest
PYTHON=$(command -v python3) authtest

View File

@ -54,7 +54,7 @@ authtest () {
echo "Running MONGODB-AWS authentication tests with $PYTHON"
$PYTHON --version
$VIRTUALENV -p $PYTHON --system-site-packages --never-download venvaws
$VIRTUALENV -p $PYTHON --never-download venvaws
if [ "Windows_NT" = "$OS" ]; then
. venvaws/Scripts/activate
else

View File

@ -8,9 +8,9 @@ set -o errexit
if [ -z "$PYTHON_BINARY" ]; then
echo "No python binary specified"
PYTHON=$(command -v python || command -v python3) || true
PYTHON=$(command -v python3) || true
if [ -z "$PYTHON" ]; then
echo "Cannot test without python or python3 installed!"
echo "Cannot test without python3 installed!"
exit 1
fi
else

View File

@ -14,7 +14,7 @@ export TEST_PATH="${PROJECT_DIRECTORY}/driver-performance-test-data"
export OUTPUT_FILE="${PROJECT_DIRECTORY}/results.json"
MTCBIN=/opt/mongodbtoolchain/v2/bin
VIRTUALENV="$MTCBIN/virtualenv -p $MTCBIN/python2.7"
VIRTUALENV="$MTCBIN/virtualenv -p $MTCBIN/python3"
$VIRTUALENV pyperftest
. pyperftest/bin/activate

View File

@ -11,7 +11,6 @@ set -o errexit # Exit the script with error if any of the commands fail
# COVERAGE If non-empty, run the test suite with coverage.
# TEST_ENCRYPTION If non-empty, install pymongocrypt.
# LIBMONGOCRYPT_URL The URL to download libmongocrypt.
# SETDEFAULTENCODING The encoding to set via sys.setdefaultencoding.
if [ -n "${SET_XTRACE_ON}" ]; then
set -o xtrace
@ -29,7 +28,6 @@ COMPRESSORS=${COMPRESSORS:-}
MONGODB_API_VERSION=${MONGODB_API_VERSION:-}
TEST_ENCRYPTION=${TEST_ENCRYPTION:-}
LIBMONGOCRYPT_URL=${LIBMONGOCRYPT_URL:-}
SETDEFAULTENCODING=${SETDEFAULTENCODING:-}
DATA_LAKE=${DATA_LAKE:-}
if [ -n "$COMPRESSORS" ]; then
@ -40,9 +38,6 @@ if [ -n "$MONGODB_API_VERSION" ]; then
export MONGODB_API_VERSION=$MONGODB_API_VERSION
fi
export JAVA_HOME=/opt/java/jdk8
if [ "$AUTH" != "noauth" ]; then
if [ -z "$DATA_LAKE" ]; then
export DB_USER="bob"
@ -62,43 +57,26 @@ fi
. .evergreen/utils.sh
if [ -z "$PYTHON_BINARY" ]; then
VIRTUALENV=$(command -v virtualenv) || true
if [ -z "$VIRTUALENV" ]; then
PYTHON=$(command -v python || command -v python3) || true
if [ -z "$PYTHON" ]; then
echo "Cannot test without python or python3 installed!"
exit 1
fi
else
$VIRTUALENV pymongotestvenv
. pymongotestvenv/bin/activate
PYTHON=python
trap "deactivate; rm -rf pymongotestvenv" EXIT HUP
# Use Python 3 from the server toolchain to test on ARM, POWER or zSeries if a
# system python3 doesn't exist. This seems to only be an issue on RHEL 7.x.
PYTHON=$(command -v python3 || command -v /opt/mongodbtoolchain/v2/bin/python3) || true
if [ -z "$PYTHON" ]; then
echo "Cannot test without python3 installed!"
exit 1
fi
elif [ "$COMPRESSORS" = "snappy" ]; then
$PYTHON_BINARY -m virtualenv --system-site-packages --never-download snappytest
$PYTHON_BINARY -m virtualenv --never-download snappytest
. snappytest/bin/activate
trap "deactivate; rm -rf snappytest" EXIT HUP
# 0.5.2 has issues in pypy3(.5)
pip install python-snappy==0.5.1
PYTHON=python
elif [ "$COMPRESSORS" = "zstd" ]; then
$PYTHON_BINARY -m virtualenv --system-site-packages --never-download zstdtest
$PYTHON_BINARY -m virtualenv --never-download zstdtest
. zstdtest/bin/activate
trap "deactivate; rm -rf zstdtest" EXIT HUP
pip install zstandard
PYTHON=python
elif [ -n "$SETDEFAULTENCODING" ]; then
$PYTHON_BINARY -m virtualenv --system-site-packages --never-download encodingtest
. encodingtest/bin/activate
trap "deactivate; rm -rf encodingtest" EXIT HUP
mkdir test-sitecustomize
cat <<EOT > test-sitecustomize/sitecustomize.py
import sys
sys.setdefaultencoding("$SETDEFAULTENCODING")
EOT
export PYTHONPATH="$(pwd)/test-sitecustomize"
PYTHON=python
else
PYTHON="$PYTHON_BINARY"
fi
@ -158,13 +136,6 @@ if [ -n "$TEST_ENCRYPTION" ]; then
fi
PYTHON_IMPL=$($PYTHON -c "import platform, sys; sys.stdout.write(platform.python_implementation())")
if [ $PYTHON_IMPL = "Jython" ]; then
PYTHON_ARGS="-J-XX:-UseGCOverheadLimit -J-Xmx4096m"
else
PYTHON_ARGS=""
fi
if [ -z "$DATA_LAKE" ]; then
TEST_ARGS=""
else
@ -217,7 +188,7 @@ if [ -z "$GREEN_FRAMEWORK" ]; then
# causing this script to exit.
$PYTHON -c "from bson import _cbson; from pymongo import _cmessage"
fi
$COVERAGE_OR_PYTHON $PYTHON_ARGS $COVERAGE_ARGS setup.py $C_EXTENSIONS test $TEST_ARGS $OUTPUT
$COVERAGE_OR_PYTHON $COVERAGE_ARGS setup.py $C_EXTENSIONS test $TEST_ARGS $OUTPUT
else
# --no_ext has to come before "test" so there is no way to toggle extensions here.
$PYTHON green_framework_test.py $GREEN_FRAMEWORK $OUTPUT

View File

@ -10,9 +10,8 @@ createvirtualenv () {
if $PYTHON -m virtualenv --version; then
VIRTUALENV="$PYTHON -m virtualenv --never-download"
elif $PYTHON -m venv -h>/dev/null; then
# System virtualenv might not be compatible with the python3 on our path
VIRTUALENV="$PYTHON -m venv"
elif command -v virtualenv; then
VIRTUALENV="$(command -v virtualenv) -p $PYTHON --never-download"
else
echo "Cannot test without virtualenv"
exit 1

View File

@ -51,15 +51,12 @@ try:
import OpenSSL
import requests
import service_identity
from pymongo.ocsp_support import _load_trusted_ca_certs
_HAVE_PYOPENSSL = True
except ImportError:
pass
if _HAVE_PYOPENSSL:
from pymongo.ocsp_support import _load_trusted_ca_certs
else:
_load_trusted_ca_certs = None
if HAVE_SSL:
import ssl