Commit 4a52bd98 authored by Julien Muchembled's avatar Julien Muchembled

qa: rewrite tools/coverage-html in Python to make -d option usable

parent 7a75daa9
#!/bin/sh -e
for COV in coverage python-coverage
do type $COV && break
done >/dev/null 2>&1 || exit
#!/usr/bin/env python
import os, re, sys, shutil
from coverage.cmdline import main, CmdOptionParser
sys.argv.insert(1, 'html')
del CmdOptionParser.get_prog_name
$COV html "$@"
sed -i "
/assign_shortkeys *=/s/$/return;/
/^ *\.bind('keydown',/s,^,//,
" htmlcov/coverage_html.js
shutil_copyfile = shutil.copyfile
def copyfile(src, dst):
if os.path.basename(dst) == 'coverage_html.js':
with open(src) as f:
js =
js = re.sub(r"(assign_shortkeys.*\{)", r"\1return;", js)
js = re.sub(r"^( *\.bind\('keydown',)", r"//\1", js, flags=re.M)
with open(dst, 'w') as f:
shutil_copyfile(src, dst)
shutil.copyfile = copyfile
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment