fixed connection closing issues in fixtures

This commit is contained in:
2025-11-18 23:57:18 +01:00
parent 7d2eb96553
commit c38da2780a
5 changed files with 39 additions and 0 deletions

View File

@@ -18,6 +18,8 @@ def test_customer(db, test_vendor):
db.add(customer)
db.commit()
db.refresh(customer)
# Expunge customer from session to prevent ResourceWarning about unclosed connections
db.expunge(customer)
return customer
@@ -39,4 +41,6 @@ def test_customer_address(db, test_vendor, test_customer):
db.add(address)
db.commit()
db.refresh(address)
# Expunge address from session to prevent ResourceWarning about unclosed connections
db.expunge(address)
return address