Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#20538 closed Bug (fixed)

loaddata management command returns exit code of 0 on IntegrityError

Reported by: Maik Hoepfel <m@…> Owned by: nobody
Component: Core (Management commands) Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Fixtures get loaded as part of our CI process. Travis builds are reported as passing even though the loaddata management command failed to load the fixtures. I'm expecting it to return a non-zero exit code when an error is raised.

(oscar)(master) T530i:django-oscar $ sites/sandbox/ loaddata countries.json sites/_fixtures/p
ages.json sites/_fixtures/auth.json sites/_fixtures/ranges.json sites/_fixtures/offers.json
Problem installing fixture 'sites/_fixtures/offers.json': Traceback (most recent call last):
IntegrityError: Could not load offer.Benefit(pk=2): offer_benefit.type may not be NULL

(oscar)(master) T530i:django-oscar $ echo $?

Full stacktrace. The bug can be replicated by cloning django-oscar at the selected commit and calling make sandbox in a virtualenv. Having said that, I expect this to be an issue with all IntegrityErrors though.

I'm aware there's previous issues that addressed exit codes and propagating a CommandError; please note this is ticket not a duplicate of those.

Change History (2)

comment:1 Changed 5 years ago by Claude Paroz

Resolution: fixed
Status: newclosed

I'm almost certain this has been fixed in Django 1.5. Please test and reopen if you can reproduce it with that version (or master).

comment:2 Changed 5 years ago by Maik Hoepfel <m@…>

You're correct. Sorry for that.

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