Update detection of multithreaded use

This commit is contained in:
Michael Mintz 2020-01-15 02:57:45 -05:00
parent ebec788faa
commit b3303424ef
3 changed files with 8 additions and 4 deletions

View File

@ -601,7 +601,8 @@ def get_local_driver(
else:
return webdriver.Edge()
elif browser_name == constants.Browser.SAFARI:
if ("-n" in sys.argv or "".join(sys.argv) == "-c"):
arg_join = " ".join(sys.argv)
if ("-n" in sys.argv) or ("-n=" in arg_join) or (arg_join == "-c"):
# Skip if multithreaded
raise Exception("Can't run Safari tests in multi-threaded mode!")
return webdriver.Safari()

View File

@ -121,7 +121,8 @@ def copytree(src, dst, symlinks=False, ignore=None):
def archive_logs_if_set(log_path, archive_logs=False):
""" Handle Logging """
if "-n" in sys.argv or "".join(sys.argv) == "-c":
arg_join = " ".join(sys.argv)
if ("-n" in sys.argv) or ("-n=" in arg_join) or (arg_join == "-c"):
return # Skip if multithreaded
if log_path.endswith("/"):
log_path = log_path[:-1]
@ -172,7 +173,8 @@ def log_folder_setup(log_path, archive_logs=False):
if not settings.ARCHIVE_EXISTING_LOGS and not archive_logs:
shutil.rmtree(archived_logs)
else:
if ("-n" in sys.argv or "".join(sys.argv) == "-c"):
a_join = " ".join(sys.argv)
if ("-n" in sys.argv) or ("-n=" in a_join) or (a_join == "-c"):
# Logs are saved/archived now if tests are multithreaded
pass
else:

View File

@ -407,7 +407,8 @@ def pytest_configure(config):
sb_config.pytest_html_report = config.getoption('htmlpath') # --html=FILE
if sb_config.reuse_session:
if "-n" in sys.argv or "".join(sys.argv) == "-c":
arg_join = " ".join(sys.argv)
if ("-n" in sys.argv) or ("-n=" in arg_join) or (arg_join == "-c"):
# Can't "reuse_session" if multithreaded
sb_config.reuse_session = False