Skip to content

Commit c095305

Browse files
committed
Fix test
1 parent a497b90 commit c095305

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tests/compas/datastructures/test_mesh.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import tempfile
23

34
import pytest
45

@@ -167,13 +168,15 @@ def test_from_ploygons():
167168
# --------------------------------------------------------------------------
168169

169170
def test_to_obj():
170-
mesh = Mesh.from_obj(compas.get('faces.obj'))
171-
mesh.to_obj('data/temp.obj')
172-
mesh = Mesh.from_obj(compas.get('temp.obj'))
173-
assert mesh.number_of_faces() == 25
174-
assert mesh.number_of_vertices() == 36
175-
assert mesh.number_of_edges() == 60
176-
os.remove(compas.get('temp.obj'))
171+
with tempfile.TemporaryDirectory() as tempdir:
172+
fname = os.path.join(tempdir, 'temp.obj')
173+
mesh = Mesh.from_obj(compas.get('faces.obj'))
174+
mesh.to_obj(fname)
175+
mesh = Mesh.from_obj(fname)
176+
assert mesh.number_of_faces() == 25
177+
assert mesh.number_of_vertices() == 36
178+
assert mesh.number_of_edges() == 60
179+
os.remove(fname)
177180

178181

179182
def test_to_vertices_and_faces():

0 commit comments

Comments
 (0)