Skip to content

Commit 06baee3

Browse files
committed
Use tmp_path in tests
1 parent 1795f4b commit 06baee3

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

tests/test_mvr_01_write_ours.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2323
# SOFTWARE.
2424

25-
import pytest
26-
from pathlib import Path
2725
import pymvr
26+
import pytest
2827

2928

3029
def process_mvr_child_list(child_list, mvr_scene):
@@ -46,11 +45,11 @@ def process_mvr_child_list(child_list, mvr_scene):
4645

4746

4847
@pytest.mark.parametrize("mvr_scene", [("basic_fixture.mvr",)], indirect=True)
49-
def test_write_mvr_file(mvr_scene):
48+
def test_write_mvr_file(mvr_scene, tmp_path):
5049
mvr = pymvr.GeneralSceneDescriptionWriter()
5150
mvr_scene.scene.to_xml(mvr.xml_root)
5251
mvr_scene.user_data.to_xml(mvr.xml_root)
5352
# TODO: add back file iteration to include gdtf files in the zip file
5453

55-
test_file_path = Path(Path(__file__).parent, "test.mvr")
54+
test_file_path = tmp_path / "test.mvr"
5655
mvr.write_mvr(test_file_path)

tests/test_mvr_03_write_ours_json.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2323
# SOFTWARE.
2424

25-
from pathlib import Path
2625
import pymvr
2726

2827

29-
def test_write_from_json():
28+
def test_write_from_json(tmp_path):
3029
# TODO: add some assertions
3130
data = [
3231
{
@@ -83,5 +82,5 @@ def test_write_from_json():
8382

8483
scene = pymvr.Scene(layers=layers)
8584
scene.to_xml(mvr.xml_root)
86-
test_file_path = Path(Path(__file__).parent, "test_json.mvr")
85+
test_file_path = tmp_path / "test_json.mvr"
8786
mvr.write_mvr(test_file_path)

tests/test_mvr_05_example.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2323
# SOFTWARE.
2424

25-
from pathlib import Path
2625
import pymvr
2726

2827

29-
def test_write_example_mvr_file():
28+
def test_write_example_mvr_file(tmp_path):
3029
fixtures_list = []
3130
mvr = pymvr.GeneralSceneDescriptionWriter()
3231

@@ -46,5 +45,5 @@ def test_write_example_mvr_file():
4645
scene.to_xml(parent=mvr.xml_root)
4746

4847
mvr.files_list = list(set(fixtures_list))
49-
test_file_path = Path(Path(__file__).parent, "example.mvr")
48+
test_file_path = tmp_path / "example.mvr"
5049
mvr.write_mvr(test_file_path)

0 commit comments

Comments
 (0)