@@ -1616,6 +1616,7 @@ def test_wrap_extend(test_project, class_list: str, model_type: str, field: str,
16161616 "domains_custom_layers" ,
16171617 "domains_custom_xy" ,
16181618 "absorption" ,
1619+ "absorption_different_function" ,
16191620 ],
16201621)
16211622def test_save_load (project , request ):
@@ -1637,24 +1638,25 @@ def test_save_load(project, request):
16371638def test_relative_paths ():
16381639 """Test that ``try_relative_to`` correctly creates relative paths to subfolders."""
16391640
1640- with tempfile .TemporaryDirectory () as tmp :
1641- data_path = Path (tmp , "data/myfile.dat" )
1641+ cur_path = Path ("." ).resolve ()
1642+ data_path = cur_path / "data/myfile.dat"
1643+ assert Path (ratapi .project .try_relative_to (data_path , cur_path )) == Path ("data/myfile.dat" )
16421644
1643- assert Path (ratapi .project .try_relative_to (data_path , tmp )) == Path ("data/myfile.dat" )
1645+ # relative path will be left relative.
1646+ data_path = "data/myfile.dat"
1647+ assert Path (ratapi .project .try_relative_to (data_path , cur_path )) == Path ("data/myfile.dat" )
16441648
16451649
16461650def test_relative_paths_warning ():
16471651 """Test that we get a warning for trying to walk up paths."""
16481652
1649- data_path = "/tmp/project/data/mydata.dat"
1650- relative_path = "/tmp/project/project_path/myproj.dat"
1653+ cur_path = Path ("." ).resolve ()
1654+ data_path = cur_path / "tmp/project/data/mydata.dat"
1655+ relative_path = cur_path / "tmp/project/project_path/myproj.dat"
16511656
16521657 with pytest .warns (
16531658 match = "Could not write custom file path as relative to the project directory, "
16541659 "which means that it may not work on other devices. If you would like to share your project, "
16551660 "make sure your custom files are in a subfolder of the project save location." ,
16561661 ):
1657- assert (
1658- Path (ratapi .project .try_relative_to (data_path , relative_path ))
1659- == Path ("/tmp/project/data/mydata.dat" ).resolve ()
1660- )
1662+ assert Path (ratapi .project .try_relative_to (data_path , relative_path )) == data_path
0 commit comments