[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8847: [PATCH 4/8] tests: honour $PYTHON override
From: |
Stefano Lattarini |
Subject: |
bug#8847: [PATCH 4/8] tests: honour $PYTHON override |
Date: |
Mon, 19 Nov 2012 23:12:19 +0100 |
* t/ax/am-test-lib.sh (require_tool): Here.
* t/python-too-old.sh: And here.
* t/python-vars.sh: And here.
* t/python-virtualenv.sh: And here. Also add some sanity
checks while at it.
Signed-off-by: Stefano Lattarini <address@hidden>
---
t/ax/am-test-lib.sh | 5 +++--
t/python-too-old.sh | 3 ++-
t/python-vars.sh | 2 --
t/python-virtualenv.sh | 9 ++++++++-
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/t/ax/am-test-lib.sh b/t/ax/am-test-lib.sh
index e69a904..85fb7c4 100644
--- a/t/ax/am-test-lib.sh
+++ b/t/ax/am-test-lib.sh
@@ -662,8 +662,9 @@ require_tool ()
;;
python)
# Python doesn't support --version, it has -V
- echo "$me: running python -V"
- python -V || skip_all_ "python interpreter not available"
+ PYTHON=${PYTHON-python}
+ echo "$me: running $PYTHON -V"
+ $PYTHON -V || skip_all_ "python interpreter not available"
;;
ro-dir)
# Skip this test case if read-only directories aren't supported
diff --git a/t/python-too-old.sh b/t/python-too-old.sh
index e4185fc..b479c9e 100755
--- a/t/python-too-old.sh
+++ b/t/python-too-old.sh
@@ -34,6 +34,7 @@ py_too_old ()
grep '[Pp]ython interpreter is too old' stderr
}
+saved_PYTHON=$PYTHON; export saved_PYTHON
PYTHON=; unset PYTHON
cat > configure.ac <<END
@@ -50,7 +51,7 @@ py_too_old python
mkdir bin
cat > bin/my-python << 'END'
#! /bin/sh
-exec python ${1+"$@"}
+exec $saved_PYTHON ${1+"$@"}
END
chmod a+x bin/my-python
PATH=$(pwd)/bin$PATH_SEPARATOR$PATH
diff --git a/t/python-vars.sh b/t/python-vars.sh
index 5bac280..0c2c08b 100755
--- a/t/python-vars.sh
+++ b/t/python-vars.sh
@@ -23,8 +23,6 @@ required=python
# In case the user's config.site defines pythondir or pyexecdir.
CONFIG_SITE=/dev/null; export CONFIG_SITE
-PYTHON=python
-
# Update the definition below if the documentation changes.
# Note that the value of the 'pythondir' and 'pyexecdir' variables can
# vary among different python installations, so we need more relaxed
diff --git a/t/python-virtualenv.sh b/t/python-virtualenv.sh
index f1e0494..23a9edc 100755
--- a/t/python-virtualenv.sh
+++ b/t/python-virtualenv.sh
@@ -23,8 +23,10 @@ required='cc python virtualenv'
# In case the user's config.site defines pythondir or pyexecdir.
CONFIG_SITE=/dev/null; export CONFIG_SITE
+py_version_pre=$($PYTHON -V)
+
# Skip the test if a proper virtualenv cannot be created.
-virtualenv --verbose virtenv && test -f virtenv/bin/activate \
+virtualenv -p"$PYTHON" --verbose virtenv && test -f virtenv/bin/activate \
|| skip_ "couldn't create python virtual environment"
# Activate the virtualenv.
@@ -34,6 +36,11 @@ if test -z "$VIRTUAL_ENV"; then
framework_failure_ "can't activate python virtual environment"
fi
+py_version_post=$(python -V)
+
+# Sanity check.
+test "$py_version_pre" = "$py_version_post"
+
cwd=$(pwd) || fatal_ "getting current working directory"
py_version=$(python -c 'import sys; print("%u.%u" %
tuple(sys.version_info[:2]))')
py_site=$VIRTUAL_ENV/lib/python$py_version/site-packages
--
1.8.0.209.gf3828dc
- bug#8847: [PATCH] Improve python support, Stefano Lattarini, 2012/11/19
- bug#8847: [PATCH 0/8] tests: support for PEP-3147, and testsuite fixes, Stefano Lattarini, 2012/11/19
- bug#8847: [PATCH 1/8] python: improve support for modern python (CPython 3.2 and PyPy), Stefano Lattarini, 2012/11/19
- bug#8847: [PATCH 2/8] news: document fix for bug#8847 (PEP-3147, __pycache__), Stefano Lattarini, 2012/11/19
- bug#8847: [PATCH 3/8] tests: typofix in message, Stefano Lattarini, 2012/11/19
- bug#8847: [PATCH 5/8] tests: improve a comment, Stefano Lattarini, 2012/11/19
- bug#8847: [PATCH 4/8] tests: honour $PYTHON override,
Stefano Lattarini <=
- bug#8847: [PATCH 6/8] python: uninstall cater to PEP-3147, Stefano Lattarini, 2012/11/19
- bug#8847: [PATCH 8/8] tests: fix a spurious failure when $PYTHON is in the environment, Stefano Lattarini, 2012/11/19
- bug#8847: [PATCH 7/8] python tests: support PEP-3147 installation layout, Stefano Lattarini, 2012/11/19
- bug#8847: [PATCH 0/8] tests: support for PEP-3147, and testsuite fixes, Stefano Lattarini, 2012/11/21