So that you don't deadlock the test run if you forget to call commit()
e.g. If you use svcconn to create a test table for use by tests, and
forget to call svcconn.commit(), the first test to (try to) touch the
table will block forever waiting on the svcconn transaction to commit.
"""
from psycopg3 import Connection
- conn = Connection.connect(dsn)
+ conn = Connection.connect(dsn, autocommit=True)
yield conn
conn.close()
create table execmany (id serial primary key, num integer, data text)
"""
)
- svcconn.commit()
@pytest.fixture(scope="function")
def execmany(svcconn, _execmany):
cur = svcconn.cursor()
cur.execute("truncate table execmany")
- svcconn.commit()
def test_executemany(conn, execmany):
create table execmany (id serial primary key, num integer, data text)
"""
)
- svcconn.commit()
async def test_executemany(aconn, execmany):
create type testcomp as (foo text, bar int8, baz float8);
"""
)
- svcconn.commit()
def test_fetch_info(conn, testcomp):