MCPcopy
hub / github.com/psycopg/psycopg / test_autocommit_property

Function test_autocommit_property

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

Source from the content-addressed store, hash-verified

446
447@skip_async
448def test_autocommit_property(conn):
449 assert conn.autocommit is False
450
451 conn.autocommit = True
452 assert conn.autocommit
453 cur = conn.cursor()
454 cur.execute("select 1")
455 assert cur.fetchone() == (1,)
456 assert conn.pgconn.transaction_status == pq.TransactionStatus.IDLE
457
458 conn.autocommit = ""
459 assert isinstance(conn.autocommit, bool)
460 assert conn.autocommit is False
461
462 conn.autocommit = "yeah"
463 assert isinstance(conn.autocommit, bool)
464 assert conn.autocommit is True
465
466
467def test_autocommit_connect(conn_cls, dsn):

Callers

nothing calls this directly

Calls 3

cursorMethod · 0.45
executeMethod · 0.45
fetchoneMethod · 0.45

Tested by

no test coverage detected