Opened 4 years ago

Closed 3 years ago

#16802 closed New feature (fixed)

Core management commands should have defined success/fail semantics

Reported by: jdunck Owned by: nobody
Component: Core (Management commands) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


call_command('loaddata'...) does not throw an exception if loading the fixture fails. I was trying to use this in a test runner, and it would be nice to early-exit the runner if a fixture load fails.

It would be nice of call_command returned False or threw an exception upon the command failing.

Change History (2)

comment:1 Changed 4 years ago by gabrielhurley

  • Triage Stage changed from Unreviewed to Accepted

I almost opened this exact same ticket yesterday. It will require some reworking of the overall machinery for management commands since right now returned values are treated as if they should be output to the user instead of treated as return codes, but overall this is quite necessary.

comment:2 Changed 3 years ago by claudep

  • Resolution set to fixed
  • Status changed from new to closed

loaddata does now raises CommandError on failure (6fd1950a4e29c1b5ed071a880db64103715ead51).

Note: See TracTickets for help on using tickets.
Back to Top