@@ -170,10 +170,10 @@ def parser(request):
170
170
# FILE OUTPUT
171
171
172
172
173
- def test_file_output_str_read (xml_books , parser , from_file_expected , temp_file ):
173
+ def test_file_output_str_read (xml_books , parser , from_file_expected , tmp_path ):
174
174
df_file = read_xml (xml_books , parser = parser )
175
175
176
- path = temp_file . parent / "test.xml"
176
+ path = tmp_path / "test.xml"
177
177
df_file .to_xml (path , parser = parser )
178
178
with open (path , "rb" ) as f :
179
179
output = f .read ().decode ("utf-8" ).strip ()
@@ -183,10 +183,10 @@ def test_file_output_str_read(xml_books, parser, from_file_expected, temp_file):
183
183
assert output == from_file_expected
184
184
185
185
186
- def test_file_output_bytes_read (xml_books , parser , from_file_expected , temp_file ):
186
+ def test_file_output_bytes_read (xml_books , parser , from_file_expected , tmp_path ):
187
187
df_file = read_xml (xml_books , parser = parser )
188
188
189
- path = temp_file . parent / "test.xml"
189
+ path = tmp_path / "test.xml"
190
190
df_file .to_xml (path , parser = parser )
191
191
with open (path , "rb" ) as f :
192
192
output = f .read ().decode ("utf-8" ).strip ()
@@ -218,7 +218,7 @@ def test_wrong_file_path(parser, geom_df):
218
218
# INDEX
219
219
220
220
221
- def test_index_false (xml_books , parser , temp_file ):
221
+ def test_index_false (xml_books , parser , tmp_path ):
222
222
expected = """\
223
223
<?xml version='1.0' encoding='utf-8'?>
224
224
<data>
@@ -247,7 +247,7 @@ def test_index_false(xml_books, parser, temp_file):
247
247
248
248
df_file = read_xml (xml_books , parser = parser )
249
249
250
- path = temp_file . parent / "test.xml"
250
+ path = tmp_path / "test.xml"
251
251
df_file .to_xml (path , index = False , parser = parser )
252
252
with open (path , "rb" ) as f :
253
253
output = f .read ().decode ("utf-8" ).strip ()
@@ -257,7 +257,7 @@ def test_index_false(xml_books, parser, temp_file):
257
257
assert output == expected
258
258
259
259
260
- def test_index_false_rename_row_root (xml_books , parser , temp_file ):
260
+ def test_index_false_rename_row_root (xml_books , parser , tmp_path ):
261
261
expected = """\
262
262
<?xml version='1.0' encoding='utf-8'?>
263
263
<books>
@@ -286,7 +286,7 @@ def test_index_false_rename_row_root(xml_books, parser, temp_file):
286
286
287
287
df_file = read_xml (xml_books , parser = parser )
288
288
289
- path = temp_file . parent / "test.xml"
289
+ path = tmp_path / "test.xml"
290
290
df_file .to_xml (path , index = False , root_name = "books" , row_name = "book" , parser = parser )
291
291
with open (path , "rb" ) as f :
292
292
output = f .read ().decode ("utf-8" ).strip ()
@@ -862,20 +862,20 @@ def test_encoding_option_str(xml_baby_names, parser):
862
862
assert output == encoding_expected
863
863
864
864
865
- def test_correct_encoding_file (xml_baby_names , temp_file ):
865
+ def test_correct_encoding_file (xml_baby_names , tmp_path ):
866
866
pytest .importorskip ("lxml" )
867
867
df_file = read_xml (xml_baby_names , encoding = "ISO-8859-1" , parser = "lxml" )
868
868
869
- path = temp_file . parent / "test.xml"
869
+ path = tmp_path / "test.xml"
870
870
df_file .to_xml (path , index = False , encoding = "ISO-8859-1" , parser = "lxml" )
871
871
872
872
873
873
@pytest .mark .parametrize ("encoding" , ["UTF-8" , "UTF-16" , "ISO-8859-1" ])
874
- def test_wrong_encoding_option_lxml (xml_baby_names , parser , encoding , temp_file ):
874
+ def test_wrong_encoding_option_lxml (xml_baby_names , parser , encoding , tmp_path ):
875
875
pytest .importorskip ("lxml" )
876
876
df_file = read_xml (xml_baby_names , encoding = "ISO-8859-1" , parser = "lxml" )
877
877
878
- path = temp_file . parent / "test.xml"
878
+ path = tmp_path / "test.xml"
879
879
df_file .to_xml (path , index = False , encoding = encoding , parser = parser )
880
880
881
881
@@ -1123,7 +1123,7 @@ def test_incorrect_xsl_eval(geom_df):
1123
1123
geom_df .to_xml (stylesheet = StringIO (xsl ))
1124
1124
1125
1125
1126
- def test_incorrect_xsl_apply (geom_df , temp_file ):
1126
+ def test_incorrect_xsl_apply (geom_df , tmp_path ):
1127
1127
lxml_etree = pytest .importorskip ("lxml.etree" )
1128
1128
1129
1129
xsl = """\
@@ -1139,7 +1139,7 @@ def test_incorrect_xsl_apply(geom_df, temp_file):
1139
1139
</xsl:stylesheet>"""
1140
1140
1141
1141
with pytest .raises (lxml_etree .XSLTApplyError , match = "Cannot resolve URI" ):
1142
- path = temp_file . parent / "test.xml"
1142
+ path = tmp_path / "test.xml"
1143
1143
geom_df .to_xml (path , stylesheet = StringIO (xsl ))
1144
1144
1145
1145
@@ -1311,10 +1311,10 @@ def test_compression_output(parser, compression_only, geom_df, temp_file):
1311
1311
1312
1312
1313
1313
def test_filename_and_suffix_comp (
1314
- parser , compression_only , geom_df , compression_to_extension , temp_file
1314
+ parser , compression_only , geom_df , compression_to_extension , tmp_path
1315
1315
):
1316
1316
compfile = "xml." + compression_to_extension [compression_only ]
1317
- path = temp_file . parent / compfile
1317
+ path = tmp_path / compfile
1318
1318
geom_df .to_xml (path , parser = parser , compression = compression_only )
1319
1319
1320
1320
with get_handle (
0 commit comments