11import os
22import shutil
3- import sys
43import time
54from seleniumbase .config import settings
65from seleniumbase .fixtures import constants
@@ -26,11 +25,7 @@ def reset_downloads_folder():
2625 if os .path .exists (downloads_path ) and not os .listdir (downloads_path ) == []:
2726 archived_downloads_folder = os .path .join (downloads_path , '..' ,
2827 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 )
3429
3530
3631def reset_downloads_folder_assistant (archived_downloads_folder ):
@@ -43,8 +38,11 @@ def reset_downloads_folder_assistant(archived_downloads_folder):
4338 archived_downloads_folder , int (time .time ()))
4439 if os .path .exists (downloads_path ):
4540 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
4846 if not settings .ARCHIVE_EXISTING_DOWNLOADS :
4947 try :
5048 shutil .rmtree (new_archived_downloads_sub_folder )
0 commit comments