fix: garantir limpeza de CLIENTE_CONTATO mesmo se assert falhar (test_excluir_cliente_com_contato_bloqueia)

This commit is contained in:
Gustavo
2026-08-13 09:51:13 -03:00
parent 2ecf866678
commit 680b7433a4
+8 -7
View File
@@ -98,12 +98,13 @@ def test_excluir_cliente_com_contato_bloqueia(cliente_id):
finally: finally:
conn.close() conn.close()
with pytest.raises(db_clientes.ClienteComDependenciasError):
db_clientes.excluir_cliente(cliente_id)
conn = get_connection()
try: try:
with conn.cursor() as cur: with pytest.raises(db_clientes.ClienteComDependenciasError):
cur.execute("DELETE FROM CLIENTE_CONTATO WHERE CLIENTE_ID = %s", (cliente_id,)) db_clientes.excluir_cliente(cliente_id)
finally: finally:
conn.close() conn = get_connection()
try:
with conn.cursor() as cur:
cur.execute("DELETE FROM CLIENTE_CONTATO WHERE CLIENTE_ID = %s", (cliente_id,))
finally:
conn.close()