Skip to content

Commit 8dc28c8

Browse files
committed
try to fix test issue on windows
1 parent eb145e0 commit 8dc28c8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/integ/test_direct_file_operation_utils.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
from snowflake.connector import SnowflakeConnection, SnowflakeCursor
2323

2424

25+
def _normalize_windows_local_path(path):
26+
return path.replace("\\", "\\\\")
27+
28+
2529
def _validate_upload_content(
2630
expected_content, cursor, stage_name, local_dir, base_file_name, is_compressed
2731
):
@@ -30,7 +34,9 @@ def _validate_upload_content(
3034
local_path = os.path.join(local_dir, base_file_name)
3135

3236
cursor.execute(
33-
f"GET ? 'file://{local_dir}'", params=[stage_path], _force_qmark_paramstyle=True
37+
f"GET ? 'file://{_normalize_windows_local_path(local_dir)}'",
38+
params=[stage_path],
39+
_force_qmark_paramstyle=True,
3440
)
3541
if is_compressed:
3642
stage_path += gz_suffix
@@ -90,7 +96,7 @@ def test_upload(
9096
):
9197
def upload_task(cursor, stage_name, temp_dir, base_file_name):
9298
cursor._upload(
93-
local_file_name=f"file://{os.path.join(temp_dir, base_file_name)}",
99+
local_file_name=f"file://{_normalize_windows_local_path(os.path.join(temp_dir, base_file_name))}",
94100
stage_location=f"@{stage_name}",
95101
options={"auto_compress": is_compressed},
96102
)

0 commit comments

Comments
 (0)