From 9d75fd33d99d3e9198f71f0b9d5701d251c6d79f Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 9 Nov 2015 21:56:08 -0800 Subject: [PATCH] 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. --- tools/test-all | 2 ++ tools/test-management | 18 ++++++++++++++++++ tools/travis/backend | 1 + 3 files changed, 21 insertions(+) create mode 100755 tools/test-management diff --git a/tools/test-all b/tools/test-all index ee4ddbf3b6..f2afc7ae3a 100755 --- a/tools/test-all +++ b/tools/test-all @@ -18,5 +18,7 @@ run ./tools/lint-all run ./tools/test-js-with-node run ./tools/test-backend 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' diff --git a/tools/test-management b/tools/test-management new file mode 100755 index 0000000000..5451bea2fa --- /dev/null +++ b/tools/test-management @@ -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!" diff --git a/tools/travis/backend b/tools/travis/backend index e1b3d206f9..a608c2f87e 100755 --- a/tools/travis/backend +++ b/tools/travis/backend @@ -5,3 +5,4 @@ source /srv/zulip-venv/bin/activate export PATH=$PATH:/srv/zulip-venv/bin ./tools/lint-all ./tools/test-backend +./tools/test-management