test(sequence): Use mariadb client's exception handling

This commit is contained in:
Gavin D'souza 2022-06-17 11:32:40 +05:30
parent a03bf6b0bb
commit ca0016a996

View file

@ -1,5 +1,4 @@
import psycopg2
import pymysql
import frappe
from frappe.tests.utils import FrappeTestCase
@ -35,10 +34,10 @@ class TestSequence(FrappeTestCase):
try:
frappe.db.get_next_sequence_val(seq_name)
except pymysql.err.OperationalError as e:
self.assertEqual(e.args[0], 4084)
except psycopg2.errors.SequenceGeneratorLimitExceeded:
pass
except frappe.db.ProgrammingError as e:
self.assertEqual(getattr(e, "errno", None), 4084)
else:
self.fail("NEXTVAL didn't raise any error upon sequence's end")