changeset 583:7f4503715326 pytest2

init_test_app and deinit_test_app called in test_backends_fs2 and test_backends_memory
author pkumar <contactprashantat@gmail.com>
date Tue, 21 Jun 2011 15:29:10 +0530
parents 32025c625b66
children fefd0baf5c89
files MoinMoin/storage/_tests/test_backends_fs2.py MoinMoin/storage/_tests/test_backends_memory.py
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/storage/_tests/test_backends_fs2.py	Tue Jun 21 15:04:12 2011 +0530
+++ b/MoinMoin/storage/_tests/test_backends_fs2.py	Tue Jun 21 15:29:10 2011 +0530
@@ -17,10 +17,13 @@
 class TestFS2Backend(BackendTest):
 
     def create_backend(self):
+        # temporary hack till we use some cleanup mechnism on tests.
+        self.app, self.ctx = init_test_app(wikiconfig.Config)
         self.tempdir = tempfile.mkdtemp('', 'moin-')
         return RouterBackend([('/', FS2Backend(self.tempdir))], index_uri='sqlite://')
 
     def kill_backend(self):
+        deinit_test_app(self.app, self.ctx)
         try:
             for root, dirs, files in os.walk(self.tempdir):
                 for d in dirs:
@@ -32,8 +35,6 @@
             shutil.rmtree(self.tempdir)
 
     def test_large(self):
-        # temporary hack till we use some cleanup mechnism on tests.
-        self.app, self.ctx = init_test_app(wikiconfig.Config)
         i = self.backend.create_item(u'large')
         r = i.create_revision(0)
         r['0'] = 'x' * 100
@@ -51,7 +52,6 @@
         for x in xrange(1000):
             assert r.read(8 * 10) == 'lalala! ' * 10
         assert r.read() == ''
-        deinit_test_app(self.app, self.ctx)
 
     def test_all_unlocked(self):
         i1 = self.backend.create_item(u'existing now 1')
--- a/MoinMoin/storage/_tests/test_backends_memory.py	Tue Jun 21 15:04:12 2011 +0530
+++ b/MoinMoin/storage/_tests/test_backends_memory.py	Tue Jun 21 15:29:10 2011 +0530
@@ -20,9 +20,12 @@
     """
 
     def create_backend(self):
+        # temporary hack till we apply some cleanup mechanism on tests         
+        self.app, self.ctx = init_test_app(wikiconfig.Config)
         return MemoryBackend()
 
     def kill_backend(self):
+        deinit_test_app(self.app, self.ctx)
         pass
 
 class TestTracingBackend(BackendTest):