git-filter-repo/t/run_coverage
Elijah Newren 904e03f963 filter-repo: workaround Windows' insistence that command args be strings
It appears that in addition to Windows requiring cwd be a string (and
not a bytestring), it also requires the command line arguments to be
unicode strings.  This appears to be a python-on-Windows issue at the
surface (attempts to quote things that assumes the arguments are all
strings), but whether it's solely a python-on-Windows issue or there is
also a deeper Windows issue, we can workaround this brain-damage by
extending the SubprocessWrapper slightly.  As with the cwd changes, only
apply this on Windows and not elsewhere because there are perfectly
legitimate reasons to pass non-unicode parameters (e.g. filenames that
are not valid unicode).

Signed-off-by: Elijah Newren <newren@gmail.com>
2019-10-30 09:14:02 -07:00

32 lines
735 B
Bash
Executable File

#!/bin/bash
orig_dir=$(cd $(dirname $0) && pwd -P)
tmpdir=$(mktemp -d)
cat <<EOF >$tmpdir/.coveragerc
[run]
parallel=true
data_file=$tmpdir/.coverage
EOF
cat <<EOF >$tmpdir/sitecustomize.py
import coverage
coverage.process_startup()
EOF
export COVERAGE_PROCESS_START=$tmpdir/.coveragerc
export PYTHONPATH=$tmpdir:
# We pretend filenames are unicode for two reasons: (1) because it exercises
# more code, and (2) this setting will detect accidental use of unicode strings
# for file/directory names when it should always be bytestrings.
export PRETEND_UNICODE_ARGS=1
ls t939*.sh | xargs -n 1 bash
cd $tmpdir
python3-coverage combine
python3-coverage html -d $orig_dir/report
python3-coverage report -m
cd $orig_dir
rm -rf $tmpdir