diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6237716e..606f97f9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,8 +33,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install django==${{ matrix.django-version }} - pip install redis django-redis rq sentry-sdk rq-scheduler + pip install django==${{ matrix.django-version }} \ + redis django-redis pyyaml rq sentry-sdk rq-scheduler - name: Run Test run: | diff --git a/django_rq/management/commands/rqstats.py b/django_rq/management/commands/rqstats.py index 17634fe9..2222a606 100644 --- a/django_rq/management/commands/rqstats.py +++ b/django_rq/management/commands/rqstats.py @@ -1,7 +1,7 @@ import click import time -from django.core.management.base import BaseCommand +from django.core.management.base import BaseCommand, CommandError from ...utils import get_statistics @@ -85,9 +85,9 @@ def handle(self, *args, **options): if options.get("yaml"): try: import yaml - except ImportError: - click.echo("Aborting. LibYAML is not installed.") - return + except ImportError as ex: + raise CommandError("PyYAML is not installed.") from ex + # Disable YAML alias yaml.Dumper.ignore_aliases = lambda *args: True click.echo(yaml.dump(get_statistics(), default_flow_style=False))