Georges Racinet has proposed merging
lp:~openerp-community-testers/openobject-server/trunk-sequences-test-bug-1083724
into lp:openobject-server.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #1083724 in OpenERP Server: "Failing and blocking unit test on sequences"
https://bugs.launchpad.net/openobject-server/+bug/1083724
For more details, see:
https://code.launchpad.net/~openerp-community-testers/openobject-server/trunk-sequences-test-bug-1083724/+merge/136489
Checking the error code. This pattern of a posteriori checking of the exception
arguments after using self.assertRaises as a context manager is actually
inspired by python documentation
(http://docs.python.org/dev/library/unittest.html#unittest.TestCase.assertRaises)
Also now cursor closing occurs in a finally: statement to avoid blocking
besides failing
--
https://code.launchpad.net/~openerp-community-testers/openobject-server/trunk-sequences-test-bug-1083724/+merge/136489
Your team OpenERP Community Testers is subscribed to branch
lp:~openerp-community-testers/openobject-server/trunk-sequences-test-bug-1083724.
=== modified file 'openerp/tests/test_ir_sequence.py'
--- openerp/tests/test_ir_sequence.py 2012-11-07 11:10:11 +0000
+++ openerp/tests/test_ir_sequence.py 2012-11-27 18:39:22 +0000
@@ -111,13 +111,20 @@
cr0 = cursor()
cr1 = cursor()
cr1._default_log_exceptions = False # Prevent logging a traceback
- msg_re = '^could not obtain lock on row in relation "ir_sequence"$'
- with self.assertRaisesRegexp(psycopg2.OperationalError, msg_re):
+ with self.assertRaises(psycopg2.OperationalError) as raise_ctx:
n0 = registry('ir.sequence').next_by_code(cr0, ADMIN_USER_ID, 'test_sequence_type_2', {})
assert n0
n1 = registry('ir.sequence').next_by_code(cr1, ADMIN_USER_ID, 'test_sequence_type_2', {})
- cr0.close()
- cr1.close()
+
+ exc = raise_ctx.exception
+ try:
+ self.assertEquals(exc.pgcode,
+ psycopg2.errorcodes.LOCK_NOT_AVAILABLE,
+ "Unexpected PostgreSQL Error instead of "
+ "expected LOCK_NOT_AVAILABLE :" + exc.pgerror)
+ finally:
+ cr0.close()
+ cr1.close()
@classmethod
def tearDownClass(cls):
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp