0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

stop InvalidStreamModel from polluting the overall model registry

This commit is contained in:
Matt Westcott 2015-06-11 13:17:04 +01:00
parent 0143787fab
commit f35536ccee

View File

@ -1,5 +1,6 @@
import json import json
from django.apps import apps
from django.test import TestCase from django.test import TestCase
from django.db import models from django.db import models
@ -74,6 +75,17 @@ class TestLazyStreamField(TestCase):
with self.assertNumQueries(0): with self.assertNumQueries(0):
instances_lookup[self.no_image.pk].body[0] instances_lookup[self.no_image.pk].body[0]
class TestSystemCheck(TestCase):
def tearDown(self):
# unregister InvalidStreamModel from the overall model registry
# so that it doesn't break tests elsewhere
for package in ('wagtailcore', 'wagtail.wagtailcore.tests'):
try:
del apps.all_models[package]['invalidstreammodel']
except KeyError:
pass
apps.clear_cache()
def test_system_check_validates_block(self): def test_system_check_validates_block(self):
class InvalidStreamModel(models.Model): class InvalidStreamModel(models.Model):
body = StreamField([ body = StreamField([