(dsn)
| 202 | |
| 203 | |
| 204 | async def test_reset(dsn): |
| 205 | resets = 0 |
| 206 | |
| 207 | async def setup(conn): |
| 208 | async with conn.transaction(): |
| 209 | await conn.execute("set timezone to '+1:00'") |
| 210 | |
| 211 | async def reset(conn): |
| 212 | nonlocal resets |
| 213 | resets += 1 |
| 214 | async with conn.transaction(): |
| 215 | await conn.execute("set timezone to utc") |
| 216 | |
| 217 | async with pool.AsyncConnectionPool(dsn, min_size=1, reset=reset) as p: |
| 218 | async with p.connection() as conn: |
| 219 | assert resets == 0 |
| 220 | await conn.execute("set timezone to '+2:00'") |
| 221 | |
| 222 | await p.wait() |
| 223 | assert resets == 1 |
| 224 | |
| 225 | async with p.connection() as conn: |
| 226 | cur = await conn.execute("show timezone") |
| 227 | assert (await cur.fetchone()) == ("UTC",) |
| 228 | |
| 229 | await p.wait() |
| 230 | assert resets == 2 |
| 231 | |
| 232 | |
| 233 | @pytest.mark.crdb_skip("backend pid") |
nothing calls this directly
no test coverage detected