Skip to content

Commit

Permalink
Transient needed to use data in multiple tests
Browse files Browse the repository at this point in the history
  • Loading branch information
U-lis committed Apr 24, 2024
1 parent 77eb7be commit ee44d29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
from alembic.config import Config
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.orm import sessionmaker, scoped_session, make_transient

from common.models.product import Product
from common.models.receipt import Receipt
Expand Down Expand Up @@ -39,6 +39,7 @@ def session(setup_alembic):
def add_product(sess, product_list: List[Product]):
try:
for product in product_list:
make_transient(product)
sess.add(product)
sess.commit()
for p in product_list:
Expand Down

0 comments on commit ee44d29

Please sign in to comment.