You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test harness: setting .autocommit on pgc_conn silently does nothing #1420
pgc_conn is a _WatchedConnection (test/pytest/pgc_vacuity.py:1202). It forwards attribute reads through __getattr__ but has no __setattr__. So pgc_conn.autocommit = False creates an attribute on the wrapper, and the real connection stays in autocommit.
A test that relies on it fails silently. Each statement commits, and pgc_conn.rollback() does nothing. I hit this writing #1419: the twin ran compact_rewrite after pgc_conn.autocommit = False, then called rollback(), and the rewrite had committed. The arm read 10/6400 row groups where the shell twin read 10/10000. It went red only because the arm compared before and after. An arm that expected the change to persist would have passed for the wrong reason.
Today
No test in the corpus sets it to False. Two of my open PRs (#1416, #1418) set it to True, a no-op that I've since removed.
Proposed fix
Give _WatchedConnection a __setattr__ that either forwards to the real connection or raises. Raising is safer: a test that wants a transaction should issue BEGIN/ROLLBACK or open its own connection, as the existing twins do. Pin it with a guard test that assigns .autocommit and expects the chosen behaviour.
I haven't written this yet. It touches the shared harness, so I'd like your view on forward versus raise first, @OffgridwithJD.
Activity
Merge pull request #1432 from commandprompt/fix/1420-proxy-setattr
test: setting an attribute on pgc_conn or its cursors raises instead …