Adds utility to defeat segfaults in tests. Hopefully you won’t need it.

This commit is contained in:
Christopher Neugebauer 2016-04-25 15:32:59 +10:00
parent 63dfd353c1
commit 397ba207bb

View file

@ -5,6 +5,7 @@ from decimal import Decimal
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.management import call_command
from django.test import TestCase from django.test import TestCase
from registrasion.models import commerce from registrasion.models import commerce
@ -24,6 +25,16 @@ class RegistrationCartTestCase(SetTimeMixin, TestCase):
def setUp(self): def setUp(self):
super(RegistrationCartTestCase, self).setUp() super(RegistrationCartTestCase, self).setUp()
def tearDown(self):
if False:
# If you're seeing segfaults in tests, enable this.
call_command('flush', verbosity=0, interactive=False,
reset_sequences=False,
allow_cascade=False,
inhibit_post_migrate=False)
super(RegistrationCartTestCase, self).tearDown()
@classmethod @classmethod
def setUpTestData(cls): def setUpTestData(cls):