File tree Expand file tree Collapse file tree 2 files changed +24
-20
lines changed
packages/postgres-database
src/simcore_postgres_database Expand file tree Collapse file tree 2 files changed +24
-20
lines changed Original file line number Diff line number Diff line change 1- """ aiopg errors
1+ """aiopg errors
22
3- StandardError
4- |__ Warning
5- |__ Error
6- |__ InterfaceError
7- |__ DatabaseError
8- |__ DataError
9- |__ OperationalError
10- |__ IntegrityError
11- |__ InternalError
12- |__ ProgrammingError
13- |__ NotSupportedError
3+ StandardError
4+ |__ Warning
5+ |__ Error
6+ |__ InterfaceError
7+ |__ DatabaseError
8+ |__ DataError
9+ |__ OperationalError
10+ |__ IntegrityError
11+ |__ InternalError
12+ |__ ProgrammingError
13+ |__ NotSupportedError
1414
15- - aiopg reuses DBAPI exceptions
16- SEE https://aiopg.readthedocs.io/en/stable/core.html?highlight=Exception#exceptions
17- SEE http://initd.org/psycopg/docs/module.html#dbapi-exceptions
18- SEE https://www.postgresql.org/docs/current/errcodes-appendix.html
15+ - aiopg reuses DBAPI exceptions
16+ SEE https://aiopg.readthedocs.io/en/stable/core.html?highlight=Exception#exceptions
17+ SEE http://initd.org/psycopg/docs/module.html#dbapi-exceptions
18+ SEE https://www.postgresql.org/docs/current/errcodes-appendix.html
1919"""
20+
2021# NOTE: psycopg2.errors are created dynamically
2122# pylint: disable=no-name-in-module
22- from psycopg2 import DatabaseError , DataError
23+ from psycopg2 import (
24+ DatabaseError ,
25+ DataError ,
26+ )
2327from psycopg2 import Error as DBAPIError
2428from psycopg2 import (
2529 IntegrityError ,
Original file line number Diff line number Diff line change 88
99import pytest
1010import sqlalchemy as sa
11+ from asyncpg .exceptions import CheckViolationError , ForeignKeyViolationError
1112from faker import Faker
1213from pytest_simcore .helpers .faker_factories import random_product
13- from simcore_postgres_database .errors import CheckViolation , ForeignKeyViolation
1414from simcore_postgres_database .models .products import products
1515from simcore_postgres_database .models .products_prices import products_prices
1616from simcore_postgres_database .utils_products_prices import (
@@ -62,7 +62,7 @@ async def test_non_negative_price_not_allowed(
6262 connection : AsyncConnection , fake_product : Row , faker : Faker
6363):
6464 # negative price not allowed
65- with pytest .raises (CheckViolation ) as exc_info :
65+ with pytest .raises (CheckViolationError ) as exc_info :
6666 await connection .execute (
6767 products_prices .insert ().values (
6868 product_name = fake_product .name ,
@@ -102,7 +102,7 @@ async def test_delete_price_constraints(
102102 )
103103
104104 # should not be able to delete a product w/o deleting price first
105- with pytest .raises (ForeignKeyViolation ) as exc_info :
105+ with pytest .raises (ForeignKeyViolationError ) as exc_info :
106106 await connection .execute (products .delete ())
107107
108108 assert exc_info .match ("delete" )
You can’t perform that action at this time.
0 commit comments