File tree 1 file changed +10
-2
lines changed
src/tribler-core/tribler_core/tests/tools
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 11
11
import re
12
12
import shutil
13
13
import string
14
+ import sys
14
15
import time
15
16
from asyncio import Future , current_task , get_event_loop
16
17
from functools import partial
@@ -66,8 +67,15 @@ def check(*argv, **kwargs):
66
67
def tearDown (self ):
67
68
while self ._tempdirs :
68
69
temp_dir = self ._tempdirs .pop ()
69
- os .chmod (temp_dir , 0o700 )
70
- shutil .rmtree (temp_dir , ignore_errors = False )
70
+ self .remove_directory (temp_dir , ignore_errors = False )
71
+
72
+ def remove_directory (self , directory , ignore_errors = False ):
73
+ os .chmod (directory , 0o700 )
74
+ if sys .platform == 'win32' :
75
+ # Add the magic prefix \\?\ to work around long path issue
76
+ shutil .rmtree ("\\ \\ ?\\ " + str (directory ), ignore_errors = ignore_errors )
77
+ else :
78
+ shutil .rmtree (directory , ignore_errors = ignore_errors )
71
79
72
80
def temporary_directory (self , suffix = '' , exist_ok = False ):
73
81
random_string = '' .join (random .choice (string .ascii_uppercase + string .digits ) for _ in range (6 ))
You can’t perform that action at this time.
0 commit comments