File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,5 +9,10 @@ def run(Adapter):
99 a = Adapter ()
1010 try :
1111 assert a .exec_simple ("SELECT 1" )[0 ][0 ] == 1
12+ # Uniform with the four SP-3 driver ports (go/java/node/prisma):
13+ # assert the client_encoding=UTF8 pin took effect -- see
14+ # harness/targets.py's encoding rationale (backend DBs default to
15+ # SQL_ASCII; ProxySQL imposes UTF8).
16+ assert a .exec_simple ("SHOW client_encoding" )[0 ][0 ] == "UTF8"
1217 finally :
1318 a .close ()
Original file line number Diff line number Diff line change 11import os
2+ import warnings
23
34import psycopg
45import pytest
@@ -48,11 +49,26 @@ def proxy_conn():
4849
4950
5051def pytest_collection_modifyitems (config , items ):
52+ matched_ids = set ()
5153 for item in items :
5254 entry = _XFAILS .get (item .nodeid )
5355 if entry :
56+ matched_ids .add (item .nodeid )
5457 item .add_marker (
5558 pytest .mark .xfail (
5659 reason = f'{ entry ["reason" ]} ({ entry ["ref" ]} )' , strict = False
5760 )
5861 )
62+
63+ # Catalogue hygiene: a [[xfail]] entry whose test_id matched NO collected
64+ # item is currently a silent no-op (e.g. a typo'd nodeid, or a test that
65+ # was renamed/removed without updating xfail.toml). Warn -- don't fail
66+ # collection -- so a stale/typo'd entry is visible in the run instead of
67+ # quietly doing nothing forever.
68+ for test_id in _XFAILS :
69+ if test_id not in matched_ids :
70+ warnings .warn (
71+ f"xfail.toml entry test_id={ test_id !r} matched no collected "
72+ f"test item -- stale or typo'd entry?" ,
73+ stacklevel = 1 ,
74+ )
Original file line number Diff line number Diff line change @@ -110,8 +110,13 @@ func transactions() error {
110110 defer conn .Close (ctx )
111111
112112 // Cleanup runs on success AND on failure (defer), leaving no state
113- // behind, same as the Python behavior's try/finally.
113+ // behind, same as the Python behavior's try/finally. Parity with
114+ // Java/Node/Prisma: best-effort ROLLBACK first (error ignored) restores
115+ // a usable session state before the DROP -- if a non-assertion error
116+ // above left the connection mid-transaction, an aborted implicit
117+ // transaction would otherwise reject the DROP.
114118 defer func () {
119+ conn .Exec (ctx , "ROLLBACK" )
115120 conn .Exec (ctx , fmt .Sprintf ("DROP TABLE IF EXISTS %s" , txTable ))
116121 }()
117122
You can’t perform that action at this time.
0 commit comments