durusmail: durus-users: About storage locking
About storage locking
About storage locking
Rodrigo Dias Arruda Senra
2004-08-05
On Thu, 5 Aug 2004 14:31:28 -0400
Neil Schemenauer  wrote:

> Something like "self.storage = None" should do it.

 Thx Neil,but under XP it did not. Merely replacing FileStorage for
 TempFileStorage neither does the trick.
 For the time being, my quick&dirty workaround is simply to create the
 storage instance outside the fixture.

 Follows a short-snipet (broken) just in case anybody fancys
 to play with this.



import unittest
from durus.connection import Connection
from durus.file_storage import FileStorage,TempFileStorage

class DurusTestCase(unittest.TestCase):

    def setUp(self):
        ''' do this before every test case '''
        self.storage = FileStorage("test.dfs")
        self.cnx = Connection(self.storage)
        self.root = self.cnx.get_root()

    def tearDown(self):
        ''' do this after every test case '''
        self.storage = None

    def testInsert1(self):
        self.root['value1'] = 'hello dummy world!'
        self.cnx.commit()

    def testRead1(self):
        self.assertEqual(self.root['value1'],'hello dummy world!')

def quiet():
    unittest.main()

if __name__=="__main__":
    verbose()




> I suppose we should provide a close() method.

 It would meet most developers expectations!

 regards,
 Rod Senra
 rodsenra at gpr.com.br

reply