MCPcopy
hub / github.com/psycopg/psycopg / test_autocommit

Function test_autocommit

tests/test_connection.py:429–444  ·  view source on GitHub ↗
(conn)

Source from the content-addressed store, hash-verified

427
428
429def test_autocommit(conn):
430 assert conn.autocommit is False
431 conn.set_autocommit(True)
432 assert conn.autocommit
433 cur = conn.cursor()
434 cur.execute("select 1")
435 assert cur.fetchone() == (1,)
436 assert conn.pgconn.transaction_status == pq.TransactionStatus.IDLE
437
438 conn.set_autocommit("")
439 assert isinstance(conn.autocommit, bool)
440 assert conn.autocommit is False
441
442 conn.set_autocommit("yeah")
443 assert isinstance(conn.autocommit, bool)
444 assert conn.autocommit is True
445
446
447@skip_async

Callers

nothing calls this directly

Calls 4

set_autocommitMethod · 0.45
cursorMethod · 0.45
executeMethod · 0.45
fetchoneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…