1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import unittest
import os
from django.core import serializers
from django.db.models import get_apps
from django.conf import settings
from app.models import ...
class MyTestCase(unittest.TestCase):
def setUp(self):
self.apps = get_apps()
def test...(self):
...
def tearDown(self):
objects = []
for app in self.apps:
for model in get_models(app):
objects.extend(model._default_manager.all())
out = open(os.path.join(settings.SVN_DIR,'fixtures','tests.json'), 'w')
out.write(serializers.serialize('json',objects))
out.close()
|
More like this
- Unit Test Profiling by justquick 4 years, 3 months ago
- Unittest: Compare max_size with column size of database by guettli 4 years, 9 months ago
- UnitTesting without create/destroy database by crucialfelix 4 years, 3 months ago
- Fail Faster: unsafe_test Management Command by majgis 9 months, 1 week ago
- Proper fixtures loading in south data migrations by JustDelight 2 months, 2 weeks ago
Comments