Add new test for management commands running with --help.

This test caught a few bugs where refactoring had made management
commands fail (and would have caught a few more recent ones).

Ideally we'd replace this with a more advanced test that actually
tests that the management command do something useful, but it's a
start.
This commit is contained in:
Tim Abbott 2015-11-09 21:56:08 -08:00
parent 16ae985807
commit 9d75fd33d9
3 changed files with 21 additions and 0 deletions

View File

@ -18,5 +18,7 @@ run ./tools/lint-all
run ./tools/test-js-with-node run ./tools/test-js-with-node
run ./tools/test-backend run ./tools/test-backend
run ./tools/test-js-with-casper run ./tools/test-js-with-casper
# Not running management test since it takes 40s and thus is too slow to be worth it.
# run ./tools/test-management
printf '\n\e[32mAll OK!\e[0m\n' printf '\n\e[32mAll OK!\e[0m\n'

18
tools/test-management Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
set -e
echo "Testing management commands start!"
failed=0
for i in `ls */management/commands/ | grep .py$ | grep -v __init__ | sed 's/[.]py$//'`; do
if ! $(./manage.py $i --help >/dev/null); then
failed=$(expr $failed + 1)
echo "ERROR: \`./manage.py $i --help\` crashes!";
fi
done
if [ $failed -gt 0 ]; then
echo
echo "$failed management commands don't start!"
exit 1
fi
echo "All management commands start!"

View File

@ -5,3 +5,4 @@ source /srv/zulip-venv/bin/activate
export PATH=$PATH:/srv/zulip-venv/bin export PATH=$PATH:/srv/zulip-venv/bin
./tools/lint-all ./tools/lint-all
./tools/test-backend ./tools/test-backend
./tools/test-management