1
1
import os
2
2
import shutil
3
- import sys
4
3
import time
5
4
from seleniumbase .config import settings
6
5
from seleniumbase .fixtures import constants
@@ -26,11 +25,7 @@ def reset_downloads_folder():
26
25
if os .path .exists (downloads_path ) and not os .listdir (downloads_path ) == []:
27
26
archived_downloads_folder = os .path .join (downloads_path , '..' ,
28
27
ARCHIVE_DIR )
29
- if not "" .join (sys .argv ) == "-c" :
30
- # Only move files if the test run is not multi-threaded.
31
- # (Running tests with "-n NUM" will create threads that only
32
- # have "-c" in the sys.argv list. Easy to catch.)
33
- reset_downloads_folder_assistant (archived_downloads_folder )
28
+ reset_downloads_folder_assistant (archived_downloads_folder )
34
29
35
30
36
31
def reset_downloads_folder_assistant (archived_downloads_folder ):
@@ -43,8 +38,11 @@ def reset_downloads_folder_assistant(archived_downloads_folder):
43
38
archived_downloads_folder , int (time .time ()))
44
39
if os .path .exists (downloads_path ):
45
40
if not os .listdir (downloads_path ) == []:
46
- shutil .move (downloads_path , new_archived_downloads_sub_folder )
47
- os .makedirs (downloads_path )
41
+ try :
42
+ shutil .move (downloads_path , new_archived_downloads_sub_folder )
43
+ os .makedirs (downloads_path )
44
+ except Exception :
45
+ pass
48
46
if not settings .ARCHIVE_EXISTING_DOWNLOADS :
49
47
try :
50
48
shutil .rmtree (new_archived_downloads_sub_folder )
0 commit comments