Coverage for tests/test_app/management/commands/dj_params4.py: 88%
13 statements
« prev ^ index » next coverage.py v7.3.4, created at 2024-01-20 18:02 +0000
« prev ^ index » next coverage.py v7.3.4, created at 2024-01-20 18:02 +0000
1from typing import Annotated
3from django.core.management import CommandError
4from typer import Option
6from django_typer import TyperCommand, command, types
7from django_typer.tests.utils import log_django_parameters
10class Command(TyperCommand):
11 help = "Test that django parameters work as expected"
13 @command(epilog="epilog")
14 def handle(
15 self,
16 throw: bool = False,
17 verbosity: types.Verbosity = 1,
18 traceback: Annotated[
19 bool,
20 Option(
21 help=("Raise on CommandError exceptions"),
22 rich_help_panel=types.COMMON_PANEL,
23 ),
24 ] = True, # this should change the default!
25 ):
26 assert self.__class__ == Command
27 log_django_parameters(self, verbosity=verbosity, traceback=traceback)
28 if throw: 28 ↛ 29line 28 didn't jump to line 29, because the condition on line 28 was never true
29 raise CommandError("Test Exception")