Fixed #18990 -- Loaddata now complains if fixture doesn't exist

If the fixture doesn't exist, loaddata will output a warning.

The fixture named "initial_data" is exceptional though; if it
doesn't exist, the warning is not emitted. This allows syncdb and
flush management commands to attempt to load it without causing
spurious warnings.

Thanks to Derega, ptone, dirigeant and d1ffuz0r for contributions
to the ticket.
This commit is contained in:
Senko Rasic 2013-05-19 11:20:10 +02:00
parent cc3b3ba93a
commit c44a2c40fe
4 changed files with 20 additions and 9 deletions

View file

@ -100,7 +100,10 @@ class FixtureTestCase(TestCase):
)
# Load a fixture that doesn't exist
management.call_command("loaddata", "unknown.json", verbosity=0, commit=False)
import warnings
with warnings.catch_warnings(record=True):
management.call_command("loaddata", "unknown.json", verbosity=0, commit=False)
self.assertQuerysetEqual(
Article.objects.all(), [
"Django conquers world!",