Skip to content

Commit 98f5f9d

Browse files
committed
Update pytest_plugin.py to handle changes in pytest
1 parent 0c2ab28 commit 98f5f9d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

seleniumbase/plugins/pytest_plugin.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,7 +2160,12 @@ def _perform_pytest_unconfigure_(config):
21602160
from seleniumbase.core import proxy_helper
21612161

21622162
reporter = config.pluginmanager.get_plugin("terminalreporter")
2163-
duration = time.time() - reporter._sessionstarttime
2163+
start_time = None
2164+
if hasattr(reporter, "_sessionstarttime"):
2165+
start_time = reporter._sessionstarttime # (pytest < 8.4.0)
2166+
else:
2167+
start_time = reporter._session_start.time # (pytest >= 8.4.0)
2168+
duration = time.time() - start_time
21642169
if (
21652170
(hasattr(sb_config, "multi_proxy") and not sb_config.multi_proxy)
21662171
or not hasattr(sb_config, "multi_proxy")
@@ -2497,7 +2502,11 @@ def pytest_unconfigure(config):
24972502
if "--co" in sys_argv or "--collect-only" in sys_argv:
24982503
return
24992504
reporter = config.pluginmanager.get_plugin("terminalreporter")
2500-
if not hasattr(reporter, "_sessionstarttime"):
2505+
if (
2506+
not hasattr(reporter, "_sessionstarttime")
2507+
and not hasattr(reporter, "_session_start")
2508+
and not hasattr(reporter._session_start, "time")
2509+
):
25012510
return
25022511
if hasattr(sb_config, "_multithreaded") and sb_config._multithreaded:
25032512
import fasteners

0 commit comments

Comments
 (0)