Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 190771d003de51af28d29bdd0e0f2bc25f9d85a2 1 parent e83ff42
@akaariai akaariai authored
View
1  tests/fixtures/tests.py
@@ -142,6 +142,7 @@ def test_loading_and_dumping(self):
# Loading a fixture that doesn't exist emits a warning
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)
View
5 tests/fixtures_model_package/tests.py
@@ -102,8 +102,11 @@ def test_loaddata(self):
)
# 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(), [
Please sign in to comment.
Something went wrong with that request. Please try again.