Mercurial > nosedjango
view examples/project/zoo/test_race.py @ 9:35178e70f1cd
urls support in testcase objects
author | Victor Ng <victor@monkeybean.ca> |
---|---|
date | Thu, 28 Aug 2008 13:33:58 -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'