Created
May 2, 2013 15:50
-
-
Save thisboyiscrazy/5503169 to your computer and use it in GitHub Desktop.
A class for django nose testing that work with test generators and also uses transations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import transaction | |
from django.test.testcases import disable_transaction_methods, restore_transaction_methods | |
from django.core import mail | |
class TransactionTest(object): | |
def setUp(self): | |
transaction.enter_transaction_management() | |
transaction.managed(True) | |
disable_transaction_methods() | |
mail.outbox = [] | |
def tearDown(self): | |
restore_transaction_methods() | |
transaction.rollback() | |
transaction.leave_transaction_management() | |
mail.outbox = [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment