KeyError swallowed while loading command classes
|Reported by:||giovannibajo||Owned by:||nobody|
|Component:||Core (Management commands)||Version:||1.4|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The code in django.core.management.call_command() swallows all KeyErrors generated while loading a command class, and turns them into a "command unknown" error message.
The Test command for instance executes user's code while loading the command class (see django.test.simple, line 36), so any kind of KeyError in user code while running tests gets swallowed and turned into a "unknown command test", which baffles the user.
I don't know whether it's a bug in call_command() (should check for KeyErrors only while looking up a command in the command dictionaries) or in the test framework (shouldn't let user exceptions slip out of simple.py).
Change History (3)
comment:1 Changed 16 months ago by giovannibajo
- Cc giovannibajo added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 16 months ago by claudep
- Easy pickings set
- Triage Stage changed from Unreviewed to Accepted