4
4
At least as long as we are using that API layer.
5
5
"""
6
6
7
- from pathlib import (
8
- Path ,
9
- PurePosixPath ,
10
- )
7
+ from pathlib import PurePosixPath
11
8
import json
12
9
13
10
from datalad_next .tests .utils import md5sum
@@ -36,8 +33,7 @@ def test_file_handling(
36
33
37
34
path_info = dict ()
38
35
for path in paths :
39
- if path .parent != tmp_path :
40
- path .parent .mkdir ()
36
+ path .parent .mkdir (parents = True , exist_ok = True )
41
37
relative_path = path .relative_to (tmp_path )
42
38
fcontent = 'content of: ' + str (relative_path )
43
39
path .write_text (fcontent )
@@ -54,14 +50,15 @@ def test_file_handling(
54
50
path_to_check = relative_path .parent / 'mykey'
55
51
fileid = check_replace_file (odd , fileid , path_to_check , tmp_path )
56
52
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 ))
58
55
)
59
56
check_remove (odd , fileid , PurePosixPath (path .name ))
60
57
check_duplicate_file_deposition (odd , tmp_path )
61
58
62
59
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 )
65
62
assert not odd .has_path (new_path )
66
63
assert odd .has_fileid (fileid )
67
64
odd .rename_file (new_path , fileid )
0 commit comments