# HG changeset patch # User Sylvain Thénault # Date 1278345362 -7200 # Node ID 014ea69e5200ce0d6be94c3f48a59da4a70f2079 # Parent 3ee80d487f11d3e4a88345a8bd0f6caae4fa76c9 [test] running transaction while session is closed are now killed, update test accordingly diff -r 3ee80d487f11 -r 014ea69e5200 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 . -"""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()