@@ -170,10 +170,10 @@ def parser(request):
170170# FILE OUTPUT
171171
172172
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 ):
174174 df_file = read_xml (xml_books , parser = parser )
175175
176- path = temp_file . parent / "test.xml"
176+ path = tmp_path / "test.xml"
177177 df_file .to_xml (path , parser = parser )
178178 with open (path , "rb" ) as f :
179179 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):
183183 assert output == from_file_expected
184184
185185
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 ):
187187 df_file = read_xml (xml_books , parser = parser )
188188
189- path = temp_file . parent / "test.xml"
189+ path = tmp_path / "test.xml"
190190 df_file .to_xml (path , parser = parser )
191191 with open (path , "rb" ) as f :
192192 output = f .read ().decode ("utf-8" ).strip ()
@@ -218,7 +218,7 @@ def test_wrong_file_path(parser, geom_df):
218218# INDEX
219219
220220
221- def test_index_false (xml_books , parser , temp_file ):
221+ def test_index_false (xml_books , parser , tmp_path ):
222222 expected = """\
223223 <?xml version='1.0' encoding='utf-8'?>
224224<data>
@@ -247,7 +247,7 @@ def test_index_false(xml_books, parser, temp_file):
247247
248248 df_file = read_xml (xml_books , parser = parser )
249249
250- path = temp_file . parent / "test.xml"
250+ path = tmp_path / "test.xml"
251251 df_file .to_xml (path , index = False , parser = parser )
252252 with open (path , "rb" ) as f :
253253 output = f .read ().decode ("utf-8" ).strip ()
@@ -257,7 +257,7 @@ def test_index_false(xml_books, parser, temp_file):
257257 assert output == expected
258258
259259
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 ):
261261 expected = """\
262262 <?xml version='1.0' encoding='utf-8'?>
263263<books>
@@ -286,7 +286,7 @@ def test_index_false_rename_row_root(xml_books, parser, temp_file):
286286
287287 df_file = read_xml (xml_books , parser = parser )
288288
289- path = temp_file . parent / "test.xml"
289+ path = tmp_path / "test.xml"
290290 df_file .to_xml (path , index = False , root_name = "books" , row_name = "book" , parser = parser )
291291 with open (path , "rb" ) as f :
292292 output = f .read ().decode ("utf-8" ).strip ()
@@ -862,20 +862,20 @@ def test_encoding_option_str(xml_baby_names, parser):
862862 assert output == encoding_expected
863863
864864
865- def test_correct_encoding_file (xml_baby_names , temp_file ):
865+ def test_correct_encoding_file (xml_baby_names , tmp_path ):
866866 pytest .importorskip ("lxml" )
867867 df_file = read_xml (xml_baby_names , encoding = "ISO-8859-1" , parser = "lxml" )
868868
869- path = temp_file . parent / "test.xml"
869+ path = tmp_path / "test.xml"
870870 df_file .to_xml (path , index = False , encoding = "ISO-8859-1" , parser = "lxml" )
871871
872872
873873@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 ):
875875 pytest .importorskip ("lxml" )
876876 df_file = read_xml (xml_baby_names , encoding = "ISO-8859-1" , parser = "lxml" )
877877
878- path = temp_file . parent / "test.xml"
878+ path = tmp_path / "test.xml"
879879 df_file .to_xml (path , index = False , encoding = encoding , parser = parser )
880880
881881
@@ -1123,7 +1123,7 @@ def test_incorrect_xsl_eval(geom_df):
11231123 geom_df .to_xml (stylesheet = StringIO (xsl ))
11241124
11251125
1126- def test_incorrect_xsl_apply (geom_df , temp_file ):
1126+ def test_incorrect_xsl_apply (geom_df , tmp_path ):
11271127 lxml_etree = pytest .importorskip ("lxml.etree" )
11281128
11291129 xsl = """\
@@ -1139,7 +1139,7 @@ def test_incorrect_xsl_apply(geom_df, temp_file):
11391139</xsl:stylesheet>"""
11401140
11411141 with pytest .raises (lxml_etree .XSLTApplyError , match = "Cannot resolve URI" ):
1142- path = temp_file . parent / "test.xml"
1142+ path = tmp_path / "test.xml"
11431143 geom_df .to_xml (path , stylesheet = StringIO (xsl ))
11441144
11451145
@@ -1311,10 +1311,10 @@ def test_compression_output(parser, compression_only, geom_df, temp_file):
13111311
13121312
13131313def 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
13151315):
13161316 compfile = "xml." + compression_to_extension [compression_only ]
1317- path = temp_file . parent / compfile
1317+ path = tmp_path / compfile
13181318 geom_df .to_xml (path , parser = parser , compression = compression_only )
13191319
13201320 with get_handle (
0 commit comments