mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +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:
@@ -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!",
|
||||
|
||||
Reference in New Issue
Block a user