[test] running transaction while session is closed are now killed, update test accordingly stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 05 Jul 2010 17:56:02 +0200
branchstable
changeset 5889 014ea69e5200
parent 5888 3ee80d487f11
child 5890 141b935a38fc
child 5898 5630bd8f98d9
[test] running transaction while session is closed are now killed, update test accordingly
server/test/unittest_repository.py
--- a/server/test/unittest_repository.py	Mon Jul 05 17:55:41 2010 +0200
+++ b/server/test/unittest_repository.py	Mon Jul 05 17:56:02 2010 +0200
@@ -16,10 +16,7 @@
 #
 # You should have received a copy of the GNU Lesser General Public License along
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
-"""unit tests for module cubicweb.server.repository
-
-"""
-from __future__ import with_statement
+"""unit tests for module cubicweb.server.repository"""
 
 from __future__ import with_statement
 
@@ -215,7 +212,7 @@
     def test_transaction_interleaved(self):
         self.skip('implement me')
 
-    def test_close_wait_processing_request(self):
+    def test_close_kill_processing_request(self):
         repo = self.repo
         cnxid = repo.connect(self.admlogin, password=self.admpassword)
         repo.execute(cnxid, 'INSERT CWUser X: X login "toto", X upassword "tutu", X in_group G WHERE G name "users"')
@@ -226,9 +223,12 @@
             repo.close(cnxid)
         t = threading.Thread(target=close_in_a_few_moment)
         t.start()
-        try:
+        def run_transaction():
             repo.execute(cnxid, 'DELETE CWUser X WHERE X login "toto"')
             repo.commit(cnxid)
+        try:
+            ex = self.assertRaises(Exception, run_transaction)
+            self.assertEquals(str(ex), 'try to access pool on a closed session')
         finally:
             t.join()