summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Trigaux <mat@openerp.com>2014-03-06 13:44:42 +0100
committerMartin Trigaux <mat@openerp.com>2014-03-06 13:44:42 +0100
commit7ff08d5dacfec287a96b3383d9ce12f4cfda2b60 (patch)
tree1c837af318efb250fec66407e3140c536ff2e48a
parente231045095bd5bbe62f225dc6f72d1217e3e6692 (diff)
parent6f99891b82696f4d3eb059d3df8b17077011bab7 (diff)
[MERGE] [FIX] test ir.sequence: when testing the lock mechanism, verify the error based on an error code instead of the error message which is sensible to the locale of the system
bzr revid: mat@openerp.com-20140306124442-pjfpx32rpwqlag80
-rw-r--r--openerp/tests/test_ir_sequence.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/openerp/tests/test_ir_sequence.py b/openerp/tests/test_ir_sequence.py
index cbb1a347038..0b47560f3a4 100644
--- a/openerp/tests/test_ir_sequence.py
+++ b/openerp/tests/test_ir_sequence.py
@@ -8,6 +8,7 @@
# OPENERP_DATABASE=yy PYTHONPATH=../:. unit2 test_ir_sequence
# This assume an existing database.
import psycopg2
+import psycopg2.errorcodes
import unittest2
import openerp
@@ -111,11 +112,11 @@ class test_ir_sequence_no_gap(unittest2.TestCase):
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 e:
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', {})
+ self.assertEqual(e.exception.pgcode, psycopg2.errorcodes.LOCK_NOT_AVAILABLE, msg="postgresql returned an incorrect errcode")
cr0.close()
cr1.close()