Skip to content

Instantly share code, notes, and snippets.

View kunal5's full-sized avatar

Kunal Mahajan kunal5

  • SquadStack
  • Noida
View GitHub Profile
@kunal5
kunal5 / gist:73c687bab0ed64a2a6f1ce4c25002e73
Last active April 10, 2021 20:35
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: