File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 11from seleniumbase import config as sb_config
2- from seleniumbase .fixtures import shared_utils
32
43
54def end_reused_class_session_as_needed ():
@@ -10,11 +9,8 @@ def end_reused_class_session_as_needed():
109 and sb_config .shared_driver
1110 ):
1211 if (
13- not shared_utils .is_windows ()
14- or (
15- hasattr (sb_config .shared_driver , "service" )
16- and sb_config .shared_driver .service .process
17- )
12+ hasattr (sb_config .shared_driver , "service" )
13+ and sb_config .shared_driver .service .process
1814 ):
1915 try :
2016 sb_config .shared_driver .quit ()
Original file line number Diff line number Diff line change @@ -1552,6 +1552,7 @@ def pytest_configure(config):
15521552 sb_config ._SMALL_TIMEOUT = settings .SMALL_TIMEOUT
15531553 sb_config ._LARGE_TIMEOUT = settings .LARGE_TIMEOUT
15541554 sb_config .pytest_html_report = config .getoption ("htmlpath" ) # --html=FILE
1555+ sb_config ._sb_class = None # (Used with the sb fixture for "--rcs")
15551556 sb_config ._sb_node = {} # sb node dictionary (Used with the sb fixture)
15561557 # Dashboard-specific variables
15571558 sb_config ._results = {} # SBase Dashboard test results
@@ -2178,6 +2179,7 @@ def sb(request):
21782179 Usage example: "def test_one(sb):"
21792180 You may need to use this for tests that use other pytest fixtures."""
21802181 from seleniumbase import BaseCase
2182+ from seleniumbase .core import session_helper
21812183
21822184 class BaseClass (BaseCase ):
21832185 def setUp (self ):
@@ -2191,6 +2193,11 @@ def base_method(self):
21912193 pass
21922194
21932195 if request .cls :
2196+ if sb_config .reuse_class_session :
2197+ the_class = str (request .cls ).split ("." )[- 1 ].split ("'" )[0 ]
2198+ if the_class != sb_config ._sb_class :
2199+ session_helper .end_reused_class_session_as_needed ()
2200+ sb_config ._sb_class = the_class
21942201 request .cls .sb = BaseClass ("base_method" )
21952202 request .cls .sb .setUp ()
21962203 request .cls .sb ._needs_tearDown = True
You can’t perform that action at this time.
0 commit comments