Needed class whose instances are many test cases

Sumit sumit.nanda at gmail.com
Fri Nov 11 05:51:05 EST 2005


I have scinario like I have to Create resource(in __init__()) Before
Running a set of testcases and then In Testcases resources are going to
used and then It will cleared off after Running the testcases  by
destructor __del__()
import unittest
import time

class app_adminfunc(unittest.TestCase):

    def __init__(self, method = 'runTests'):
        unittest.TestCase.__init__(self, method)
#------------Resource Creation --------

    def __del__(self):
#--------------Resource Deletion -----------------

   def test01-----
   def test02-----
.......
....

But in this above code Problem is that __init__() called at each time
when the Testcase is run ,But i want Single time run of the Init Prior
to run of each tests inside the class .
Can Anybody help me on this ?




More information about the Python-list mailing list