summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2011-02-06 08:27:00 -0500
committerNed Batchelder <ned@nedbatchelder.com>2011-02-06 08:27:00 -0500
commit203798a7ff4f041a61f8318da94e14088cc29787 (patch)
treeb1263368f109d69b6aa09ec52bec13a0b950e0bb
parent3bea91e4ac4ac947852d69a05324cf8a7d6378a6 (diff)
downloadpython-coveragepy-git-203798a7ff4f041a61f8318da94e14088cc29787.tar.gz
A script to make virtualenvs for testing.
-rwxr-xr-xalltests.sh10
-rwxr-xr-xbuild_ve.sh48
2 files changed, 54 insertions, 4 deletions
diff --git a/alltests.sh b/alltests.sh
index 3371021b..be199293 100755
--- a/alltests.sh
+++ b/alltests.sh
@@ -6,16 +6,18 @@
#
# All the Python installs have a .pth pointing to the egg file created by
# 2.6, so install the testdata in 2.6
-source ../ve/26/bin/activate
+ve=${COVERAGE_VE:-../ve}
+echo "Testing in $ve"
+source $ve/26/bin/activate
make --quiet testdata
for v in 24 25 26 27 31 32 # 23
do
- source ../ve/$v/bin/activate
+ source $ve/$v/bin/activate
python setup.py -q develop
- python -c "import platform; print('=== Python %s with C tracer ===' % platform.python_version())"
+ python -c "import platform, sys; print('=== Python %s with C tracer (%s) ===' % (platform.python_version(), sys.executable))"
COVERAGE_TEST_TRACER=c nosetests $@
- python -c "import platform; print('=== Python %s with Python tracer ===' % platform.python_version())"
+ python -c "import platform, sys; print('=== Python %s with Python tracer (%s) ===' % (platform.python_version(), sys.executable))"
rm coverage/tracer*.so
COVERAGE_TEST_TRACER=py nosetests $@
done
diff --git a/build_ve.sh b/build_ve.sh
new file mode 100755
index 00000000..6493fa99
--- /dev/null
+++ b/build_ve.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+#
+# Create virtualenvs needed to test coverage.
+# Invoke with command args, a list of python installations to make virtualenvs
+# from. COVERAGE_VE should point to the directory to hold them. For example:
+#
+# COVERAGE_VE=../ve ./build_ve.sh /opt/python*
+#
+
+ve=${COVERAGE_VE:-../ve}
+
+echo "Constructing virtualenvs in $ve"
+
+rm -rf $ve
+mkdir $ve
+
+for p in $*
+do
+ echo --- $p -------------------------
+ if [ -f $p/bin/python ]; then
+ suff=
+ elif [ -f $p/bin/python3 ]; then
+ suff=3
+ else
+ echo "*** There's no Python in $p"
+ exit
+ fi
+
+ # Figure out what version we are
+ ver=`$p/bin/python$suff -c "import sys; print('%s%s' % sys.version_info[:2])"`
+ echo The version is $ver
+
+ # Make the virtualenv
+ $p/bin/virtualenv$suff $ve/$ver
+
+ # Activate the virtualenv
+ source $ve/$ver/bin/activate
+
+ # Install nose
+ easy_install nose
+
+ # Write the .pth file that lets us import our test zips.
+ libdir=`echo $ve/$ver/lib/python*/site-packages/`
+ echo `pwd`/test/eggsrc/dist/covtestegg1-0.0.0-py2.6.egg > $libdir/coverage_test_egg.pth
+
+ # Install ourselves
+ python setup.py develop
+done