aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests/helper_scripts
diff options
context:
space:
mode:
authorGravatar Matt Kwong <mattkwong@google.com>2018-05-04 12:00:25 -0700
committerGravatar Matt Kwong <mattkwong@google.com>2018-05-04 16:16:29 -0700
commitfcd04ec121664de621ceb874c44eab5fbdc6bbd7 (patch)
tree2bf84940cd17ecf4aa31b63744ace38da1f90b5c /tools/run_tests/helper_scripts
parentd5f659a2d265931f86aef3c92ad7a977c3bae8a5 (diff)
Remove the fallback when creating Python virtual env
See https://github.com/grpc/grpc/issues/15253 for more context. The original behavior when running Python tests is to try to create a virtual env with the specifed Python version. If there is an issue with that, fallback to the system's default Python version. This leads to misleading test results, so removing the fallback and failing the test when virtual env fails to instantiate the specified Python version is the new behavior.
Diffstat (limited to 'tools/run_tests/helper_scripts')
-rwxr-xr-xtools/run_tests/helper_scripts/build_python.sh15
1 files changed, 3 insertions, 12 deletions
diff --git a/tools/run_tests/helper_scripts/build_python.sh b/tools/run_tests/helper_scripts/build_python.sh
index b0a6f0f4d4..cdcb2aa116 100755
--- a/tools/run_tests/helper_scripts/build_python.sh
+++ b/tools/run_tests/helper_scripts/build_python.sh
@@ -112,10 +112,6 @@ export CFLAGS="-I$ROOT/include -std=gnu99 -fno-wrapv $CFLAGS"
export GRPC_PYTHON_BUILD_WITH_CYTHON=1
export LANG=en_US.UTF-8
-# Default python on the host to fall back to when instantiating e.g. the
-# virtualenv.
-HOST_PYTHON=${HOST_PYTHON:-python}
-
# If ccache is available on Linux, use it.
if [ "$(is_linux)" ]; then
# We're not on Darwin (Mac OS X)
@@ -132,14 +128,9 @@ fi
# Perform build operations #
############################
-# Instantiate the virtualenv, preferring to do so from the relevant python
-# version. Even if these commands fail (e.g. on Windows due to name conflicts)
-# it's possible that the virtualenv is still usable and we trust the tester to
-# be able to 'figure it out' instead of us e.g. doing potentially expensive and
-# unnecessary error recovery by `rm -rf`ing the virtualenv.
-($PYTHON -m virtualenv "$VENV" ||
- $HOST_PYTHON -m virtualenv -p "$PYTHON" "$VENV" ||
- true)
+# Instantiate the virtualenv from the Python version passed in.
+$PYTHON -m pip install virtualenv
+$PYTHON -m virtualenv "$VENV"
VENV_PYTHON=$(script_realpath "$VENV/$VENV_RELATIVE_PYTHON")
# See https://github.com/grpc/grpc/issues/14815 for more context. We cannot rely