Skip to content

Commit 8a8999e

Browse files
committed
Change votable creation to load from memory instead of file
1 parent bbf2812 commit 8a8999e

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

benchmarks/votable.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,10 @@
3434

3535
def create_votable_bytes(table_data, format_type='binary2'):
3636
"""Helper to create VOTables with a specific serialization."""
37-
with tempfile.NamedTemporaryFile(delete=False, suffix='.xml') as tmp:
38-
try:
39-
votable = from_table(table_data)
40-
votable.get_first_table().format = format_type
41-
votable.to_xml(tmp.name)
42-
with open(tmp.name, 'rb') as f:
43-
return f.read()
44-
finally:
45-
os.unlink(tmp.name)
37+
votable = from_table(table_data)
38+
output = io.BytesIO()
39+
votable.to_xml(output, tabledata_format=format_type)
40+
return output.getvalue()
4641

4742

4843
class TimeVOTableNumeric:

0 commit comments

Comments
 (0)