Skip to content

Commit b330342

Browse files
committed
Update detection of multithreaded use
1 parent ebec788 commit b330342

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,8 @@ def get_local_driver(
601601
else:
602602
return webdriver.Edge()
603603
elif browser_name == constants.Browser.SAFARI:
604-
if ("-n" in sys.argv or "".join(sys.argv) == "-c"):
604+
arg_join = " ".join(sys.argv)
605+
if ("-n" in sys.argv) or ("-n=" in arg_join) or (arg_join == "-c"):
605606
# Skip if multithreaded
606607
raise Exception("Can't run Safari tests in multi-threaded mode!")
607608
return webdriver.Safari()

seleniumbase/core/log_helper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ def copytree(src, dst, symlinks=False, ignore=None):
121121

122122
def archive_logs_if_set(log_path, archive_logs=False):
123123
""" Handle Logging """
124-
if "-n" in sys.argv or "".join(sys.argv) == "-c":
124+
arg_join = " ".join(sys.argv)
125+
if ("-n" in sys.argv) or ("-n=" in arg_join) or (arg_join == "-c"):
125126
return # Skip if multithreaded
126127
if log_path.endswith("/"):
127128
log_path = log_path[:-1]
@@ -172,7 +173,8 @@ def log_folder_setup(log_path, archive_logs=False):
172173
if not settings.ARCHIVE_EXISTING_LOGS and not archive_logs:
173174
shutil.rmtree(archived_logs)
174175
else:
175-
if ("-n" in sys.argv or "".join(sys.argv) == "-c"):
176+
a_join = " ".join(sys.argv)
177+
if ("-n" in sys.argv) or ("-n=" in a_join) or (a_join == "-c"):
176178
# Logs are saved/archived now if tests are multithreaded
177179
pass
178180
else:

seleniumbase/plugins/pytest_plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ def pytest_configure(config):
407407
sb_config.pytest_html_report = config.getoption('htmlpath') # --html=FILE
408408

409409
if sb_config.reuse_session:
410-
if "-n" in sys.argv or "".join(sys.argv) == "-c":
410+
arg_join = " ".join(sys.argv)
411+
if ("-n" in sys.argv) or ("-n=" in arg_join) or (arg_join == "-c"):
411412
# Can't "reuse_session" if multithreaded
412413
sb_config.reuse_session = False
413414

0 commit comments

Comments
 (0)