File tree Expand file tree Collapse file tree 5 files changed +67
-0
lines changed Expand file tree Collapse file tree 5 files changed +67
-0
lines changed Original file line number Diff line number Diff line change 1515)
1616from firebolt .async_db .connection import Connection , connect
1717from firebolt .async_db .cursor import Cursor
18+ from firebolt .common .exception import (
19+ DatabaseError ,
20+ DataError ,
21+ Error ,
22+ IntegrityError ,
23+ InterfaceError ,
24+ InternalError ,
25+ NotSupportedError ,
26+ OperationalError ,
27+ ProgrammingError ,
28+ Warning ,
29+ )
1830
1931apilevel = "2.0"
2032# threads may only share the module and connections, cursors should not be shared
Original file line number Diff line number Diff line change 1313 Timestamp ,
1414 TimestampFromTicks ,
1515)
16+ from firebolt .common .exception import (
17+ DatabaseError ,
18+ DataError ,
19+ Error ,
20+ IntegrityError ,
21+ InterfaceError ,
22+ InternalError ,
23+ NotSupportedError ,
24+ OperationalError ,
25+ ProgrammingError ,
26+ Warning ,
27+ )
1628from firebolt .db .connection import Connection , connect
1729from firebolt .db .cursor import Cursor
1830
Original file line number Diff line number Diff line change 1+ import firebolt .async_db
2+
3+
4+ def test_has_exceptions (db_api_exceptions ):
5+ """Verify async module has top-level dbapi exceptions exposed"""
6+ for ex_name , ex_class in db_api_exceptions .items ():
7+ assert issubclass (getattr (firebolt .async_db , ex_name ), ex_class )
Original file line number Diff line number Diff line change 66from pytest_httpx import to_response
77from pytest_httpx ._httpx_internals import Response
88
9+ from firebolt .common .exception import (
10+ DatabaseError ,
11+ DataError ,
12+ Error ,
13+ IntegrityError ,
14+ InterfaceError ,
15+ InternalError ,
16+ NotSupportedError ,
17+ OperationalError ,
18+ ProgrammingError ,
19+ Warning ,
20+ )
921from firebolt .common .settings import Settings
1022from firebolt .common .urls import (
1123 ACCOUNT_ENGINE_URL ,
@@ -202,3 +214,20 @@ def get_engines_url(settings: Settings) -> str:
202214@pytest .fixture
203215def get_databases_url (settings : Settings ) -> str :
204216 return f"https://{ settings .server } { DATABASES_URL } "
217+
218+
219+ @pytest .fixture
220+ def db_api_exceptions ():
221+ exceptions = {
222+ "DatabaseError" : DatabaseError ,
223+ "DataError" : DataError ,
224+ "Error" : Error ,
225+ "IntegrityError" : IntegrityError ,
226+ "InterfaceError" : InterfaceError ,
227+ "InternalError" : InternalError ,
228+ "NotSupportedError" : NotSupportedError ,
229+ "OperationalError" : OperationalError ,
230+ "ProgrammingError" : ProgrammingError ,
231+ "Warning" : Warning ,
232+ }
233+ return exceptions
Original file line number Diff line number Diff line change 1+ import firebolt .db
2+
3+
4+ def test_has_exceptions (db_api_exceptions ):
5+ """Verify sync module has top-level dbapi exceptions exposed"""
6+ for ex_name , ex_class in db_api_exceptions .items ():
7+ assert issubclass (getattr (firebolt .db , ex_name ), ex_class )
You can’t perform that action at this time.
0 commit comments