@@ -194,7 +194,8 @@ def tmp_dir(tmp_path_factory):
194194
195195@pytest .fixture (scope = 'session' , autouse = True )
196196def db_file (tmp_dir ):
197- test_db_filename : Path = tmp_dir / 'test-db.fdb'
197+ # Always use local tmp_dir - in CI, this will be bind-mounted to the container
198+ test_db_filename = tmp_dir / 'test-db.fdb'
198199 copyfile (_vars_ ['source_db' ], test_db_filename )
199200 if _platform != 'Windows' :
200201 test_db_filename .chmod (33206 )
@@ -208,7 +209,9 @@ def dsn(db_file):
208209 if host is None :
209210 result = str (db_file )
210211 else :
211- result = f'{ host } /{ port } :{ db_file } ' if port else f'{ host } :{ db_file } '
212+ # For remote servers, use the absolute path string of the local file
213+ # which will be the same path inside the container due to bind mount
214+ result = f'{ host } /{ port } :{ str (db_file )} ' if port else f'{ host } :{ str (db_file )} '
212215 yield result
213216
214217@pytest .fixture ()
@@ -233,8 +236,9 @@ def db_cleanup(db_connection):
233236 cur .execute ("delete from t" )
234237 cur .execute ("delete from t2" )
235238 cur .execute ("delete from FB4" )
236- db_connection .commit ()
239+ db_connection .commit ()
237240 except Exception as e :
241+ db_connection .rollback ()
238242 # Ignore errors if tables don't exist, log others
239243 if "Table unknown" not in str (e ):
240244 print (f"Warning: Error during pre-test cleanup: { e } " )
0 commit comments