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

The fixture named "initial_data" is exceptional though; if it
doesn't exist, the error is not raised. This allows syncdb and
flush management commands to attempt to load it without causing
an error if it doesn't exist.
This commit is contained in:
Senko Rasic 2013-05-18 17:51:14 +02:00
parent 0a50311063
commit cc3b3ba93a
3 changed files with 29 additions and 14 deletions

View file

@ -441,13 +441,14 @@ class TestFixtures(TestCase):
def test_loaddata_not_existant_fixture_file(self):
stdout_output = StringIO()
management.call_command(
'loaddata',
'this_fixture_doesnt_exist',
verbosity=2,
commit=False,
stdout=stdout_output,
)
with self.assertRaises(management.CommandError):
management.call_command(
'loaddata',
'this_fixture_doesnt_exist',
verbosity=2,
commit=False,
stdout=stdout_output,
)
self.assertTrue("No xml fixture 'this_fixture_doesnt_exist' in" in
force_text(stdout_output.getvalue()))