diff options
author | Anssi Kääriäinen <akaariai@gmail.com> | 2013-05-19 20:51:59 +0300 |
---|---|---|
committer | Anssi Kääriäinen <akaariai@gmail.com> | 2013-05-19 20:53:49 +0300 |
commit | 190771d003de51af28d29bdd0e0f2bc25f9d85a2 (patch) | |
tree | 211c5b77fd9a29a267e08d1571287bd0523543ac /tests/fixtures_model_package | |
parent | e83ff42792eb52235cacda58f3441673cc4e4c94 (diff) | |
download | django-190771d003de51af28d29bdd0e0f2bc25f9d85a2.tar.gz |
Fixed fixtures testing failure
The failure was caused by generating the same warning from two tests.
The second time the same warning was raised it was swallowed by the
"once" simplefilter of warnings.
Diffstat (limited to 'tests/fixtures_model_package')
-rw-r--r-- | tests/fixtures_model_package/tests.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/fixtures_model_package/tests.py b/tests/fixtures_model_package/tests.py index fbd0271336..e0a35e300d 100644 --- a/tests/fixtures_model_package/tests.py +++ b/tests/fixtures_model_package/tests.py @@ -102,8 +102,11 @@ class FixtureTestCase(TestCase): ) # Load a fixture that doesn't exist - with warnings.catch_warnings(record=True): + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") management.call_command("loaddata", "unknown.json", verbosity=0, commit=False) + self.assertEqual(len(w), 1) + self.assertTrue(w[0].message, "No fixture named 'unknown' found.") self.assertQuerysetEqual( Article.objects.all(), [ |