2
2
set -o errexit # Exit the script with error if any of the commands fail
3
3
4
4
# Supported/used environment variables:
5
- # SET_XTRACE_ON Set to non-empty to write all commands first to stderr.
6
- # AUTH Set to enable authentication. Defaults to "noauth"
7
- # SSL Set to enable SSL. Defaults to "nossl"
8
- # PYTHON_BINARY The Python version to use. Defaults to whatever is available
9
- # GREEN_FRAMEWORK The green framework to test with, if any.
10
- # C_EXTENSIONS Pass --no_ext to setup.py, or not.
11
- # COVERAGE If non-empty, run the test suite with coverage.
12
- # TEST_ENCRYPTION If non-empty, install pymongocrypt.
13
- # LIBMONGOCRYPT_URL The URL to download libmongocrypt.
5
+ # SET_XTRACE_ON Set to non-empty to write all commands first to stderr.
6
+ # AUTH Set to enable authentication. Defaults to "noauth"
7
+ # SSL Set to enable SSL. Defaults to "nossl"
8
+ # PYTHON_BINARY The Python version to use. Defaults to whatever is available
9
+ # GREEN_FRAMEWORK The green framework to test with, if any.
10
+ # C_EXTENSIONS Pass --no_ext to setup.py, or not.
11
+ # COVERAGE If non-empty, run the test suite with coverage.
12
+ # TEST_ENCRYPTION If non-empty, install pymongocrypt.
13
+ # LIBMONGOCRYPT_URL The URL to download libmongocrypt.
14
+ # SETDEFAULTENCODING The encoding to set via sys.setdefaultencoding.
14
15
15
16
if [ -n " ${SET_XTRACE_ON} " ]; then
16
17
set -o xtrace
@@ -28,6 +29,7 @@ COVERAGE=${COVERAGE:-}
28
29
COMPRESSORS=${COMPRESSORS:- }
29
30
TEST_ENCRYPTION=${TEST_ENCRYPTION:- }
30
31
LIBMONGOCRYPT_URL=${LIBMONGOCRYPT_URL:- }
32
+ SETDEFAULTENCODING=${SETDEFAULTENCODING:- }
31
33
32
34
if [ -n " $COMPRESSORS " ]; then
33
35
export COMPRESSORS=$COMPRESSORS
@@ -72,6 +74,17 @@ elif [ "$COMPRESSORS" = "zstd" ]; then
72
74
trap " deactivate; rm -rf zstdtest" EXIT HUP
73
75
pip install zstandard
74
76
PYTHON=python
77
+ elif [ -n " $SETDEFAULTENCODING " ]; then
78
+ $PYTHON_BINARY -m virtualenv --system-site-packages --never-download encodingtest
79
+ . encodingtest/bin/activate
80
+ trap " deactivate; rm -rf encodingtest" EXIT HUP
81
+ mkdir test-sitecustomize
82
+ cat << EOT > test-sitecustomize/sitecustomize.py
83
+ import sys
84
+ sys.setdefaultencoding("$SETDEFAULTENCODING ")
85
+ EOT
86
+ export PYTHONPATH=" $( pwd) /test-sitecustomize"
87
+ PYTHON=python
75
88
else
76
89
PYTHON=" $PYTHON_BINARY "
77
90
fi
0 commit comments