MCPcopy
hub / github.com/psycopg/psycopg / test_close

Function test_close

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

Source from the content-addressed store, hash-verified

171
172
173def test_close(conn):
174 assert not conn.closed
175 assert not conn.broken
176
177 cur = conn.cursor()
178
179 conn.close()
180 assert conn.closed
181 assert not conn.broken
182 assert conn.pgconn.status == pq.ConnStatus.BAD
183
184 conn.close()
185 assert conn.closed
186 assert conn.pgconn.status == pq.ConnStatus.BAD
187
188 with pytest.raises(psycopg.OperationalError):
189 cur.execute("select 1")
190
191
192@pytest.mark.crdb_skip("pg_terminate_backend")

Callers

nothing calls this directly

Calls 3

cursorMethod · 0.45
closeMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected