loaddata should allow empty fixtures
The loading
management command does the following test:
# If the fixture we loaded contains 0 objects, assume that an
# error was encountered during fixture loading.
if objects_in_fixture == 0:
self.stderr.write(
self.style.ERROR("No fixture data found for '%s'. (File format may be invalid.)\n" %
(fixture_name)))
if commit:
transaction.rollback(using=using)
transaction.leave_transaction_management(using=using)
return
I suggest to either remove this test or to add a setting to disable it.
Because a fixture returning no objects is a perfectly possible edge case (depending on some local configuration settings) when using Python fixtures <http://lino.saffre-rumma.net/topics/dumpy.html>.
Attachments (1)
-
ticket18213.diff (1.0 KB) - added by Renato Oliveira 11 years ago.
-
I just removed the test. But, if the best way is to create a setting to disable it whenever you want, how would it be?
Download all attachments as: .zip
Change History (11)
Triage Stage: |
Unreviewed →
Accepted
|
Owner: |
changed from nobody to Renato Oliveira
|
Cc: |
Renato Oliveira added
|
Has patch: |
set
|
Needs tests: |
set
|
Patch needs improvement: |
set
|
Owner: |
changed from Renato Oliveira to Przemek Lewandowski
|
Status: |
new →
assigned
|
Needs tests: |
unset
|
Patch needs improvement: |
unset
|
Component: |
Uncategorized →
Core (Management commands)
|
Cc: |
timograham@… added
|
Patch needs improvement: |
set
|
Resolution: |
→ fixed
|
Status: |
assigned →
closed
|
I don't see any reason why an empty fixture must be an error.