@@ -1489,7 +1489,11 @@ def pytest_configure(config):
1489
1489
if sb_config .dash_title :
1490
1490
constants .Dashboard .TITLE = sb_config .dash_title .replace ("_" , " " )
1491
1491
1492
- if "--co" not in sys_argv and "--collect-only" not in sys_argv :
1492
+ if (
1493
+ sb_config ._multithreaded
1494
+ and "--co" not in sys_argv
1495
+ and "--collect-only" not in sys_argv
1496
+ ):
1493
1497
from seleniumbase .core import log_helper
1494
1498
from seleniumbase .core import download_helper
1495
1499
from seleniumbase .core import proxy_helper
@@ -1586,16 +1590,23 @@ def pytest_deselected(items):
1586
1590
1587
1591
def pytest_collection_finish (session ):
1588
1592
"""This runs after item collection is finalized.
1589
- Print the dashboard path if at least one test runs.
1590
1593
https://docs.pytest.org/en/stable/reference.html
1591
1594
"""
1592
1595
if "--co" in sys_argv or "--collect-only" in sys_argv :
1593
1596
return
1597
+ if len (session .items ) > 0 and not sb_config ._multithreaded :
1598
+ from seleniumbase .core import log_helper
1599
+ from seleniumbase .core import download_helper
1600
+ from seleniumbase .core import proxy_helper
1601
+
1602
+ log_helper .log_folder_setup (sb_config .log_path , sb_config .archive_logs )
1603
+ download_helper .reset_downloads_folder ()
1604
+ proxy_helper .remove_proxy_zip_if_present ()
1594
1605
if sb_config .dashboard and len (session .items ) > 0 :
1595
1606
_create_dashboard_assets_ ()
1596
- # Output Dashboard info to the console
1607
+ # Print the Dashboard path if at least one test runs.
1597
1608
sb_config .item_count_untested = sb_config .item_count
1598
- dash_path = os .getcwd () + "/ dashboard.html"
1609
+ dash_path = os .path . join ( os . getcwd (), " dashboard.html")
1599
1610
star_len = len ("Dashboard: " ) + len (dash_path )
1600
1611
try :
1601
1612
terminal_size = os .get_terminal_size ().columns
@@ -1694,7 +1705,9 @@ def pytest_sessionfinish(session):
1694
1705
def pytest_terminal_summary (terminalreporter ):
1695
1706
if "--co" in sys_argv or "--collect-only" in sys_argv :
1696
1707
return
1697
- latest_logs_dir = os .getcwd () + "/latest_logs/"
1708
+ if not sb_config .item_count > 0 :
1709
+ return
1710
+ latest_logs_dir = os .path .join (os .getcwd (), "latest_logs" ) + os .sep
1698
1711
if sb_config ._multithreaded :
1699
1712
if os .path .exists (latest_logs_dir ) and os .listdir (latest_logs_dir ):
1700
1713
sb_config ._has_exception = True
@@ -1739,7 +1752,7 @@ def _perform_pytest_unconfigure_():
1739
1752
except Exception :
1740
1753
pass
1741
1754
sb_config .shared_driver = None
1742
- if hasattr (sb_config , "log_path" ):
1755
+ if hasattr (sb_config , "log_path" ) and sb_config . item_count > 0 :
1743
1756
log_helper .archive_logs_if_set (
1744
1757
sb_config .log_path , sb_config .archive_logs
1745
1758
)
0 commit comments