@@ -39,19 +39,19 @@ def ensure_reset_dir(path):
39
39
path .mkdir ()
40
40
41
41
42
- def on_rm_rf_error (func , epath : str , exc , * , startpath ):
42
+ def on_rm_rf_error (func , path : str , exc , * , start_path ):
43
43
"""Handles known read-only errors during rmtree."""
44
44
excvalue = exc [1 ]
45
45
46
46
if not isinstance (excvalue , PermissionError ):
47
47
warnings .warn (
48
- PytestWarning ("(rm_rf) error removing {}: {}" .format (epath , excvalue ))
48
+ PytestWarning ("(rm_rf) error removing {}: {}" .format (path , excvalue ))
49
49
)
50
50
return
51
51
52
52
if func not in (os .rmdir , os .remove , os .unlink ):
53
53
warnings .warn (
54
- PytestWarning ("(rm_rf) error removing {}: {}" .format (epath , excvalue ))
54
+ PytestWarning ("(rm_rf) error removing {}: {}" .format (path , excvalue ))
55
55
)
56
56
return
57
57
@@ -64,23 +64,23 @@ def chmod_rw(p: str):
64
64
65
65
# For files, we need to recursively go upwards in the directories to
66
66
# ensure they all are also writable.
67
- p = Path (epath )
67
+ p = Path (path )
68
68
if p .is_file ():
69
69
for parent in p .parents :
70
70
chmod_rw (str (parent ))
71
71
# stop when we reach the original path passed to rm_rf
72
- if parent == startpath :
72
+ if parent == start_path :
73
73
break
74
- chmod_rw (str (epath ))
74
+ chmod_rw (str (path ))
75
75
76
- func (epath )
76
+ func (path )
77
77
78
78
79
79
def rm_rf (path : Path ):
80
80
"""Remove the path contents recursively, even if some elements
81
81
are read-only.
82
82
"""
83
- onerror = partial (on_rm_rf_error , startpath = path )
83
+ onerror = partial (on_rm_rf_error , start_path = path )
84
84
shutil .rmtree (str (path ), onerror = onerror )
85
85
86
86
0 commit comments