Skip to content

Commit af46d5e

Browse files
committed
Update download_helper
1 parent d2a664c commit af46d5e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

seleniumbase/core/download_helper.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import shutil
3-
import sys
43
import time
54
from seleniumbase.config import settings
65
from 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

3631
def 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

Comments
 (0)