'Try to draw a number from two transactions.
This is expected to not work.'

def test_ir_sequence_draw_twice_no_gap(self):

    with environment() as env0:
        with environment() as env1:
            env1.cr._default_log_exceptions = False
            with self.assertRaises(psycopg2.OperationalError) as e:
                n0 = env0['ir.sequence'].next_by_code('test_sequence_type_2')
                self.assertTrue(n0)
                n1 = env1['ir.sequence'].next_by_code('test_sequence_type_2')
            self.assertEqual(e.exception.pgcode, psycopg2.errorcodes.LOCK_NOT_AVAILABLE, msg='postgresql    returned    an    incorrect    errcode')
