diff options
author | Morgan Aubert <morgan.aubert@impakfinance.com> | 2018-04-27 17:18:15 -0400 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-05-09 11:40:28 -0400 |
commit | 704443acacf0dfbcb1c52df4b260585055754ce7 (patch) | |
tree | 600147bf6114d7b490fcd253ff9797b7e7531c09 /tests/fixtures | |
parent | 7ba040de7703fd06b9b35ddd31da40103d911c30 (diff) | |
download | django-704443acacf0dfbcb1c52df4b260585055754ce7.tar.gz |
Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage().
Diffstat (limited to 'tests/fixtures')
-rw-r--r-- | tests/fixtures/tests.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py index a27ad6183d..d48062f8dd 100644 --- a/tests/fixtures/tests.py +++ b/tests/fixtures/tests.py @@ -495,16 +495,9 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase): parent. """ ProxySpy.objects.create(name='Paul') - - with warnings.catch_warnings(record=True) as warning_list: - warnings.simplefilter('always') + msg = "fixtures.ProxySpy is a proxy model and won't be serialized." + with self.assertWarnsMessage(ProxyModelWarning, msg): self._dumpdata_assert(['fixtures.ProxySpy'], '[]') - warning = warning_list.pop() - self.assertEqual(warning.category, ProxyModelWarning) - self.assertEqual( - str(warning.message), - "fixtures.ProxySpy is a proxy model and won't be serialized." - ) def test_dumpdata_proxy_with_concrete(self): """ |