Opened 12 years ago

Closed 12 years ago

Last modified 12 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

Description

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/manage.py 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 $?
0

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 by Claude Paroz, 12 years ago

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 by Maik Hoepfel <m@…>, 12 years ago

You're correct. Sorry for that.

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