xonsh/scripts/run_tests.sh
Kurtis Rader 27132bb999 Add a makefile defining some common tasks.
This makefile makes it easier to run things like unit tests and pylint
against the code. Especially before doing a commit. It also helps ensure
unit tests are not affected by local config files (e.g., ~/.xonshrc).
2015-11-11 18:05:17 -08:00

24 lines
618 B
Bash

#!/bin/sh
#
# Run all the nosetests or just the ones relevant for the edited files.
#
if [[ $1 == "-e" ]]; then
tmp_file=$(mktemp /tmp/nose_tests_XXXXXX)
git status -s |
awk '/\.py$/ { print $2 }' |
while read f; do
if [[ $f == xonsh/* ]]; then
f="tests/test_$(basename $f)"
if [[ -f $f ]]; then
echo $f
fi
else
echo $f
fi
done |
sort -u > $tmp_file
XONSHRC=/dev/null nosetests -v $(< $tmp_file)
rm $tmp_file
else
XONSHRC=/dev/null nosetests
fi