Skip to content

Commit abf8680

Browse files
authored
SNOW-2044853: Fix XML reader test in stored proc (#3345)
1 parent 5445b42 commit abf8680

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

tests/integ/scala/test_dataframe_reader_suite.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ def get_df_from_reader_and_file_format(reader, file_format):
136136

137137
@pytest.fixture(scope="module", autouse=True)
138138
def setup(session, resources_path, local_testing_mode):
139+
# TODO SNOW-2098847: remove this workaround after fixing the issue
140+
session._use_scoped_temp_objects = False
141+
139142
test_files = TestFiles(resources_path)
140143
if not local_testing_mode:
141144
Utils.create_stage(session, tmp_stage_name1, is_temporary=True)
@@ -1971,10 +1974,6 @@ def test_read_multiple_csvs(session):
19711974
"config.getoption('local_testing_mode', default=False)",
19721975
reason="xml not supported in local testing mode",
19731976
)
1974-
@pytest.mark.skipif(
1975-
IS_IN_STORED_PROC,
1976-
reason="SNOW-2044853: Flaky in stored procedure test",
1977-
)
19781977
@pytest.mark.parametrize(
19791978
"file,row_tag,expected_row_count,expected_column_count",
19801979
[
@@ -1997,10 +1996,6 @@ def test_read_xml_row_tag(
19971996
"config.getoption('local_testing_mode', default=False)",
19981997
reason="xml not supported in local testing mode",
19991998
)
2000-
@pytest.mark.skipif(
2001-
IS_IN_STORED_PROC,
2002-
reason="SNOW-2044853: Flaky in stored procedure test",
2003-
)
20041999
def test_read_xml_no_xxe(session):
20052000
row_tag = "bar"
20062001
stage_file_path = f"@{tmp_stage_name1}/{test_file_xxe_xml}"
@@ -2012,10 +2007,6 @@ def test_read_xml_no_xxe(session):
20122007
"config.getoption('local_testing_mode', default=False)",
20132008
reason="xml not supported in local testing mode",
20142009
)
2015-
@pytest.mark.skipif(
2016-
IS_IN_STORED_PROC,
2017-
reason="SNOW-2044853: Flaky in stored procedure test",
2018-
)
20192010
def test_read_xml_query_nested_data(session):
20202011
row_tag = "tag"
20212012
df = session.read.option("rowTag", row_tag).xml(
@@ -2046,10 +2037,6 @@ def test_read_xml_non_existing_file(session):
20462037
"config.getoption('local_testing_mode', default=False)",
20472038
reason="xml not supported in local testing mode",
20482039
)
2049-
@pytest.mark.skipif(
2050-
IS_IN_STORED_PROC,
2051-
reason="SNOW-2044853: Flaky in stored procedure test",
2052-
)
20532040
@pytest.mark.parametrize(
20542041
"file",
20552042
(
@@ -2060,12 +2047,13 @@ def test_read_xml_non_existing_file(session):
20602047
)
20612048
def test_read_malformed_xml(session, file):
20622049
row_tag = "record"
2050+
file_path = f"@{tmp_stage_name1}/{file}"
20632051

20642052
# permissive mode
20652053
df = (
20662054
session.read.option("rowTag", row_tag)
20672055
.option("mode", "permissive")
2068-
.xml(f"@{tmp_stage_name1}/{file}")
2056+
.xml(file_path)
20692057
)
20702058
result = df.collect()
20712059
assert len(result) == 2
@@ -2079,17 +2067,15 @@ def test_read_malformed_xml(session, file):
20792067
df = (
20802068
session.read.option("rowTag", row_tag)
20812069
.option("mode", "dropmalformed")
2082-
.xml(f"@{tmp_stage_name1}/{test_file_malformed_no_closing_tag_xml}")
2070+
.xml(file_path)
20832071
)
20842072
result = df.collect()
20852073
assert len(result) == 1
20862074
assert len(result[0]) == 3
20872075

20882076
# failfast mode
20892077
df = (
2090-
session.read.option("rowTag", row_tag)
2091-
.option("mode", "failfast")
2092-
.xml(f"@{tmp_stage_name1}/{test_file_malformed_no_closing_tag_xml}")
2078+
session.read.option("rowTag", row_tag).option("mode", "failfast").xml(file_path)
20932079
)
20942080
with pytest.raises(SnowparkSQLException, match="Malformed XML record at bytes"):
20952081
df.collect()

0 commit comments

Comments
 (0)