Skip to content

Instantly share code, notes, and snippets.

@kunal5
Last active April 10, 2021 20:35
Show Gist options
  • Save kunal5/73c687bab0ed64a2a6f1ce4c25002e73 to your computer and use it in GitHub Desktop.
Save kunal5/73c687bab0ed64a2a6f1ce4c25002e73 to your computer and use it in GitHub Desktop.
using transaction test cases without flush
from django.test.testcases import TransactionTestCase
from rest_framework.test import APITransactionTestCase
class TransactionTestCaseWithoutFlush(TransactionTestCase):
def _fixture_teardown(self):
"""
Prevents TransactionTestCase from calling the flush command. 'flush' calls TRUNCATE on postgres and it's
awfully slow. Use at your own risk
:return:
"""
pass
class APITransactionTestCaseWithoutFlush(APITransactionTestCase):
def _fixture_teardown(self):
"""
Prevents TransactionTestCase from calling the flush command. 'flush' calls TRUNCATE on postgres and it's
awfully slow. Use at your own risk
:return:
"""
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment