(dsn)
| 174 | |
| 175 | |
| 176 | async def test_configure(dsn): |
| 177 | inits = 0 |
| 178 | |
| 179 | async def configure(conn): |
| 180 | nonlocal inits |
| 181 | inits += 1 |
| 182 | async with conn.transaction(): |
| 183 | await conn.execute("set default_transaction_read_only to on") |
| 184 | |
| 185 | async with pool.AsyncConnectionPool(dsn, min_size=1, configure=configure) as p: |
| 186 | await p.wait(timeout=1.0) |
| 187 | async with p.connection() as conn: |
| 188 | assert inits == 1 |
| 189 | res = await conn.execute("show default_transaction_read_only") |
| 190 | assert (await res.fetchone())[0] == "on" |
| 191 | |
| 192 | async with p.connection() as conn: |
| 193 | assert inits == 1 |
| 194 | res = await conn.execute("show default_transaction_read_only") |
| 195 | assert (await res.fetchone())[0] == "on" |
| 196 | await conn.close() |
| 197 | |
| 198 | async with p.connection() as conn: |
| 199 | assert inits == 2 |
| 200 | res = await conn.execute("show default_transaction_read_only") |
| 201 | assert (await res.fetchone())[0] == "on" |
| 202 | |
| 203 | |
| 204 | async def test_reset(dsn): |
nothing calls this directly
no test coverage detected