pelme/pytest_django — pull request #63 by GammaSQ (2013-12-30 10:48:31+00:00)
Title: Database keeps changes through one class

Changes scope of fixture 'db' dynamically, depending on kwargs for pytest.mark.django_db.
Allows one class to keep all changes in databse and allows for incremental testing of database.

!!!! BUG !!!!
@pytest.mark.django_db(class_db=True)
class TestDB:
# Tests now with classDB, but without transaction

@pytest.mark.django_db(transaction=True)
def test_smthg(self):
# Tests with classDB and (newly activated) transactions:
##### mayjor breackdown!!!!!

@pytest.mark.django_db(True, True)
class TestBlah:
### no problem

Since I don't use transactions, I don't think I will fix this anytime soon. Furthermore it's a rather rare usecase I believe.