MCPcopy
hub / github.com/psycopg/psycopg / work

Function work

tests/test_cursor.py:78–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76 row_factory = getattr(rows, row_factory)
77
78 def work():
79 with conn_cls.connect(dsn) as conn, conn.transaction(force_rollback=True):
80 with conn.cursor(binary=fmt_out, row_factory=row_factory) as cur:
81 cur.execute(faker.drop_stmt)
82 cur.execute(faker.create_stmt)
83 with faker.find_insert_problem(conn):
84 cur.executemany(faker.insert_stmt, faker.records)
85 cur.execute(faker.select_stmt)
86
87 if fetch == "one":
88 while cur.fetchone() is not None:
89 pass
90 elif fetch == "many":
91 while cur.fetchmany(3):
92 pass
93 elif fetch == "all":
94 cur.fetchall()
95 elif fetch == "iter":
96 for rec in cur:
97 pass
98
99 n = []
100 gc.collect()

Callers 1

test_leakFunction · 0.70

Calls 9

find_insert_problemMethod · 0.80
connectMethod · 0.45
transactionMethod · 0.45
cursorMethod · 0.45
executeMethod · 0.45
executemanyMethod · 0.45
fetchoneMethod · 0.45
fetchmanyMethod · 0.45
fetchallMethod · 0.45

Tested by

no test coverage detected