summaryrefslogtreecommitdiff
path: root/tests/fixtures_model_package
diff options
context:
space:
mode:
authorSenko Rasic <senko.rasic@dobarkod.hr>2013-05-19 11:20:10 +0200
committerSenko Rasic <senko.rasic@dobarkod.hr>2013-05-19 11:31:27 +0200
commitc44a2c40fe0ed79b0fa00233a204d41e9c677750 (patch)
tree28ffd80082bb94eb3299f059e960b56afaf96065 /tests/fixtures_model_package
parentcc3b3ba93a7bfdd2ece739e97e36150a719acd3e (diff)
downloaddjango-c44a2c40fe0ed79b0fa00233a204d41e9c677750.tar.gz
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.
Diffstat (limited to 'tests/fixtures_model_package')
-rw-r--r--tests/fixtures_model_package/tests.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/fixtures_model_package/tests.py b/tests/fixtures_model_package/tests.py
index c250f647ce..af6b059c66 100644
--- a/tests/fixtures_model_package/tests.py
+++ b/tests/fixtures_model_package/tests.py
@@ -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!",