mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
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:
parent
cc3b3ba93a
commit
c44a2c40fe
4 changed files with 20 additions and 9 deletions
|
@ -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!",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue