Upgrade sqlalchemy
Adapt code to prevent new warnings and errors (as of SQLAlchemy 1.4): - Overlapping foreign key columns could be set in a conflicting way => This is prevented by the application logic => Ignore the warning by setting a `overlaps` flag - Transaction already rolled back => This only happens when tests cause an `IntegrityError` on purpose => Filter away the corresponding warning in the fixture - Query returns `Row` objects and not scalars => Add genexpr to pull out `primary_id`
This commit is contained in:
parent
3bef9ca38d
commit
2d08afa309
6 changed files with 75 additions and 68 deletions
|
|
@ -5,6 +5,7 @@ in the CLI layer need access to the database.
|
|||
"""
|
||||
|
||||
import os
|
||||
import warnings
|
||||
|
||||
import pytest
|
||||
import sqlalchemy as sa
|
||||
|
|
@ -94,7 +95,9 @@ def db_session(db_connection):
|
|||
|
||||
finally:
|
||||
session.close()
|
||||
transaction.rollback()
|
||||
|
||||
with warnings.catch_warnings(record=True):
|
||||
transaction.rollback()
|
||||
|
||||
|
||||
# Import the fixtures from the `fake_data` sub-package.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue