Skip to content

Commit 28f08b4

Browse files
committed
fix test
1 parent 0577f8e commit 28f08b4

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/snowflake/snowpark/_internal/data_source/drivers/psycopg2_driver.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ def process(self, query: str):
286286
if session_init_statement is not None:
287287
for statement in session_init_statement:
288288
cursor.execute(statement)
289+
cursor.fetchall()
289290
cursor.execute(query)
290291
while True:
291292
rows = cursor.fetchmany(fetch_size)

tests/integ/datasource/test_oracledb.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,16 +260,17 @@ def test_query_timeout_and_session_init(session):
260260
DBMS_LOCK.SLEEP(5);
261261
END;
262262
"""
263-
with pytest.raises(
264-
SnowparkDataframeReaderException,
265-
match="socket timed out while recovering from previous socket timeout",
266-
):
263+
with pytest.raises(SnowparkDataframeReaderException) as error:
267264
session.read.dbapi(
268265
create_connection_oracledb,
269266
table=ORACLEDB_TABLE_NAME,
270267
query_timeout=1,
271268
session_init_statement=[statement],
272269
)
270+
assert (
271+
"socket timed out while recovering from previous socket timeout" in error
272+
or "call timeout of 1000 ms exceeded" in error
273+
)
273274

274275

275276
def test_query_timeout_and_session_init_udtf(session):

tests/integ/datasource/test_postgres.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_error_case(session, input_type, input_value, error_message):
108108
def test_query_timeout_and_session_init(session):
109109
with pytest.raises(
110110
SnowparkDataframeReaderException,
111-
match=r"due to exception 'QueryCanceled\('canceling statement due to statement timeout",
111+
match="canceling statement due to statement timeout",
112112
):
113113
session.read.dbapi(
114114
create_postgres_connection,

tests/integ/test_data_source_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ def fetchmany(self, row_count: int):
10181018
driver.to_snow_type(raw_schema),
10191019
partitions_table,
10201020
"",
1021-
packages=["pyodbc"],
1021+
packages=["pyodbc", "snowflake-snowpark-python"],
10221022
)
10231023
Utils.check_answer(df, sql_server_udtf_ingestion_data)
10241024

0 commit comments

Comments
 (0)