loaddata management command returns exit code of 0 on IntegrityError
|Reported by:||Owned by:||nobody|
|Component:||Core (Management commands)||Version:||1.5|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||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/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
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.