summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xalltests.sh10
-rwxr-xr-xbuild_ve.sh48
-rw-r--r--coverage/htmlfiles/coverage_html.js32
3 files changed, 71 insertions, 19 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
diff --git a/coverage/htmlfiles/coverage_html.js b/coverage/htmlfiles/coverage_html.js
index a3519250..7b6db427 100644
--- a/coverage/htmlfiles/coverage_html.js
+++ b/coverage/htmlfiles/coverage_html.js
@@ -1,11 +1,12 @@
// Coverage.py HTML report browser code.
+/*jslint browser:true, indent: 4 */
+/*global coverage:true, document window $ */
coverage = {};
// Find all the elements with shortkey_* class, and use them to assign a shotrtcut key.
coverage.assign_shortkeys = function() {
$("*[class*='shortkey_']").each(function(i, e) {
- console.log(i, e);
$.each($(e).attr("class").split(" "), function(i, c) {
if (/^shortkey_/.test(c)) {
$(document).bind('keydown', c.substr(9), function() {
@@ -14,21 +15,22 @@ coverage.assign_shortkeys = function() {
}
});
});
-}
+};
// Loaded on index.html
coverage.index_ready = function($) {
// Look for a cookie containing previous sort settings:
- sort_list = [];
- cookie_name = "COVERAGE_INDEX_SORT";
+ var sort_list = [];
+ var cookie_name = "COVERAGE_INDEX_SORT";
+ var i;
// This almost makes it worth installing the jQuery cookie plugin:
if (document.cookie.indexOf(cookie_name) > -1) {
- cookies = document.cookie.split(";");
- for (var i=0; i < cookies.length; i++) {
- parts = cookies[i].split("=")
+ var cookies = document.cookie.split(";");
+ for (i = 0; i < cookies.length; i++) {
+ var parts = cookies[i].split("=");
- if ($.trim(parts[0]) == cookie_name && parts[1]) {
+ if ($.trim(parts[0]) === cookie_name && parts[1]) {
sort_list = eval("[[" + parts[1] + "]]");
break;
}
@@ -42,7 +44,7 @@ coverage.index_ready = function($) {
// Format is called by the widget before displaying:
format: function(table) {
- if (table.config.sortList.length == 0 && sort_list.length > 0) {
+ if (table.config.sortList.length === 0 && sort_list.length > 0) {
// This table hasn't been sorted before - we'll use
// our stored settings:
$(table).trigger('sorton', [sort_list]);
@@ -62,7 +64,7 @@ coverage.index_ready = function($) {
var col_count = $("table.index > thead > tr > th").length;
headers[0] = { sorter: 'text' };
- for (var i = 1; i < col_count-1; i++) {
+ for (i = 1; i < col_count-1; i++) {
headers[i] = { sorter: 'digit' };
}
headers[col_count-1] = { sorter: 'percent' };
@@ -77,21 +79,21 @@ coverage.index_ready = function($) {
// Watch for page unload events so we can save the final sort settings:
$(window).unload(function() {
- document.cookie = cookie_name + "=" + sort_list.toString() + "; path=/"
+ document.cookie = cookie_name + "=" + sort_list.toString() + "; path=/";
});
-}
+};
// -- pyfile stuff --
coverage.pyfile_ready = function($) {
// If we're directed to a particular line number, highlight the line.
var frag = location.hash;
- if (frag.length > 2 && frag[1] == 'n') {
+ if (frag.length > 2 && frag[1] === 'n') {
$(frag).addClass('highlight');
}
coverage.assign_shortkeys();
-}
+};
coverage.toggle_lines = function(btn, cls) {
btn = $(btn);
@@ -104,5 +106,5 @@ coverage.toggle_lines = function(btn, cls) {
$("#source ."+cls).addClass(hide);
btn.addClass(hide);
}
-}
+};