Mercurial > nosedjango
view examples/project/zoo/test_race.py @ 12:a6e52c3b64a8 tip
added a version code to nosedjango
author | Victor Ng <victor@monkeybean.ca> |
---|---|
date | Fri, 29 Aug 2008 14:10:47 -0400 |
parents | 22ae9aa457af |
children |
line wrap: on
line source
# We have two test classes because we want to induce a race condition # and ensure that the database is always reset between test methods from zoo.models import * class TestDBRace1(object): def setup(self): assert Zoo.objects.count() == 0 def test1(self): obj = Zoo.objects.create(name='sample1') assert Zoo.objects.count() == 1 assert Zoo.objects.all()[0].name == 'sample1' class TestDBRace2(object): def setup(self): assert Zoo.objects.count() == 0 def test1(self): obj = Zoo.objects.create(name='sample2') assert Zoo.objects.count() == 1 assert Zoo.objects.all()[0].name == 'sample2'