[Tutor] Please help understanding unittest fixtures

D. Guandalino guandalino at gmail.com
Mon Aug 22 00:15:02 CEST 2011

Suppose I have this TestCase class.

class C(TestCase):
   def setUp():
      # very time consuming and resources intensive stuffs.

   def test_A(self):
   def test_B(self):
   def test_C(self):

The unittest docs says:

> Each instance of the TestCase will only be used to run a single test
> method, so a new fixture is created for each test.

Does this mean that the setUp() method, which is called to prepare the test
fixture, get called for test_A, test_B and test_C? In this case is there a
way to force just one setUp() call?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110822/61800d7a/attachment-0001.html>

More information about the Tutor mailing list