mirror of
https://github.com/django/django.git
synced 2025-11-02 12:58:56 +00:00
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:
parent
0a50311063
commit
cc3b3ba93a
3 changed files with 29 additions and 14 deletions
|
|
@ -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()))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue