summaryrefslogtreecommitdiff
path: root/tests/fixtures_model_package
diff options
context:
space:
mode:
authorAndrew Kuchev <0coming.soon@gmail.com>2016-01-03 00:11:18 +0500
committerTim Graham <timograham@gmail.com>2016-01-04 19:39:35 -0500
commitd5b90c8e120687863c1d41cf92a4cdb11413ad7f (patch)
tree381137acc1ff5d2cc51cf92d90ecb30dfe5f8cf1 /tests/fixtures_model_package
parent2c6c873e3fca6c0c54c2335e131f7742fcf2cf26 (diff)
downloaddjango-d5b90c8e120687863c1d41cf92a4cdb11413ad7f.tar.gz
Fixed #21549 -- Made loaddata's 'fixture not found' warning an exception.
Thanks to mpasternak for the report and Tim Graham for the review.
Diffstat (limited to 'tests/fixtures_model_package')
-rw-r--r--tests/fixtures_model_package/tests.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/tests/fixtures_model_package/tests.py b/tests/fixtures_model_package/tests.py
index ef5adb3de8..6b508a1991 100644
--- a/tests/fixtures_model_package/tests.py
+++ b/tests/fixtures_model_package/tests.py
@@ -1,8 +1,7 @@
from __future__ import unicode_literals
-import warnings
-
from django.core import management
+from django.core.management import CommandError
from django.test import TestCase
from .models import Article
@@ -51,11 +50,8 @@ class FixtureTestCase(TestCase):
)
# Load a fixture that doesn't exist
- with warnings.catch_warnings(record=True) as w:
- warnings.simplefilter("always")
+ with self.assertRaisesMessage(CommandError, "No fixture named 'unknown' found."):
management.call_command("loaddata", "unknown.json", verbosity=0)
- self.assertEqual(len(w), 1)
- self.assertTrue(w[0].message, "No fixture named 'unknown' found.")
self.assertQuerysetEqual(
Article.objects.all(), [