I've been trying to split tests.py, but I've noticed that models
defined inside test module does not work. Normally one can define
models in tests.py like this:

class JSONFieldModel(models.Model):
    json = JSONField()

class JSONFieldTest(TestCase):
    def setUp(self):
        pass

    def test_json_serialization(self):
        """JSONField serialization"""
        thedata = {'test': 5}

        jsdb = JSONFieldModel(json=thedata)
        jsdb.save()
        del jsdb

        jsdb = JSONFieldModel.objects.get(pk=1)
        self.failUnlessEqual(thedata, jsdb.json,
                             'JSON Serialization mismatch')

And they are created to test database just fine. But when I split the
tests.py to package and have tests/__init__.py import all, it throws
me error of not having database tables. Tests do start just fine, but
these models are not apparently created.

Is there any good workaround for this? I really like the idea of
splitting long tests.py to logical modules.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to