44At least as long as we are using that API layer.
55"""
66
7- from pathlib import (
8- Path ,
9- PurePosixPath ,
10- )
7+ from pathlib import PurePosixPath
118import json
129
1310from datalad_next .tests .utils import md5sum
@@ -36,8 +33,7 @@ def test_file_handling(
3633
3734 path_info = dict ()
3835 for path in paths :
39- if path .parent != tmp_path :
40- path .parent .mkdir ()
36+ path .parent .mkdir (parents = True , exist_ok = True )
4137 relative_path = path .relative_to (tmp_path )
4238 fcontent = 'content of: ' + str (relative_path )
4339 path .write_text (fcontent )
@@ -54,14 +50,15 @@ def test_file_handling(
5450 path_to_check = relative_path .parent / 'mykey'
5551 fileid = check_replace_file (odd , fileid , path_to_check , tmp_path )
5652 check_rename_file (
57- odd , fileid , name = str (relative_path .parent / ('ren' + path .name ))
53+ odd , fileid ,
54+ name = PurePosixPath (relative_path .parent / ('ren' + path .name ))
5855 )
5956 check_remove (odd , fileid , PurePosixPath (path .name ))
6057 check_duplicate_file_deposition (odd , tmp_path )
6158
6259
63- def check_rename_file (odd , fileid , name = 'place.txt' ):
64- new_path = PurePosixPath (* (( 'fresh' ,) + Path ( name ). parts ) )
60+ def check_rename_file (odd , fileid , name = PurePosixPath ( 'place.txt' ) ):
61+ new_path = PurePosixPath ('fresh' / name )
6562 assert not odd .has_path (new_path )
6663 assert odd .has_fileid (fileid )
6764 odd .rename_file (new_path , fileid )
0 commit comments