Skip to content

Commit

Permalink
recode for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bckohan committed Jun 4, 2024
1 parent 620e494 commit d4827c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
10 changes: 5 additions & 5 deletions django_routines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ def routines() -> t.Generator[Routine, None, None]:
"""
from django.conf import settings

routines: t.Dict[str, t.Any]
if not settings.configured:
routines = sys._getframe(1).f_globals[ROUTINE_SETTING] # noqa: WPS437
else:
routines = getattr(settings, ROUTINE_SETTING, {})
routines = (
sys._getframe(1).f_globals[ROUTINE_SETTING] # noqa: WPS437
if not settings.configured
else getattr(settings, ROUTINE_SETTING, {})
)
for routine in routines.values():
yield Routine.from_dict(routine)
15 changes: 7 additions & 8 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,17 @@
command("test", "track", "4", priority=3, demo=6)
command("test", "track", "5", priority=6, switches=["demo"])

names = set()
for rtn in routines():
assert isinstance(rtn, Routine)
names.add(rtn.name)

assert names == {"deploy", "test"}

routine(
"bad",
_("Bad command test routine"),
RoutineCommand(("track", "0")),
RoutineCommand(("does_not_exist",)),
RoutineCommand(("track", "1")),
)


names = set()
for rtn in routines():
assert isinstance(rtn, Routine)
names.add(rtn.name)

assert names == {"deploy", "test", "bad"}

0 comments on commit d4827c3

Please sign in to comment.