Added management commands to tests

* added --run-once option to the management commands for testing
This commit is contained in:
Ilan
2015-07-16 15:17:15 +02:00
parent 1e81cc413d
commit 5a3f875baa
3 changed files with 29 additions and 4 deletions
+9
View File
@@ -7,7 +7,16 @@ class Command(BaseCommand):
# Translators: help text for qcluster management command
help = _("Starts a Django Q Cluster.")
def add_arguments(self, parser):
parser.add_argument('--run-once',
action='store_true',
dest='run_once',
default=False,
help='Run once and then stop.')
def handle(self, *args, **options):
q = Cluster()
q.start()
if options.get('run_once', False):
q.stop()