(conn_cls, conn, dsn)
| 268 | |
| 269 | @pytest.mark.usefixtures("testctx") |
| 270 | def test_context_rollback(conn_cls, conn, dsn): |
| 271 | with pytest.raises(ZeroDivisionError): |
| 272 | with conn: |
| 273 | with conn.cursor() as cur: |
| 274 | cur.execute("insert into testctx values (42)") |
| 275 | 1 / 0 |
| 276 | |
| 277 | assert conn.closed |
| 278 | assert not conn.broken |
| 279 | |
| 280 | with conn_cls.connect(dsn) as conn: |
| 281 | with conn.cursor() as cur: |
| 282 | cur.execute("select * from testctx") |
| 283 | assert cur.fetchall() == [] |
| 284 | |
| 285 | |
| 286 | def test_context_close(conn): |