File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1
1
from seleniumbase import config as sb_config
2
- from seleniumbase .fixtures import shared_utils
3
2
4
3
5
4
def end_reused_class_session_as_needed ():
@@ -10,11 +9,8 @@ def end_reused_class_session_as_needed():
10
9
and sb_config .shared_driver
11
10
):
12
11
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
18
14
):
19
15
try :
20
16
sb_config .shared_driver .quit ()
Original file line number Diff line number Diff line change @@ -1552,6 +1552,7 @@ def pytest_configure(config):
1552
1552
sb_config ._SMALL_TIMEOUT = settings .SMALL_TIMEOUT
1553
1553
sb_config ._LARGE_TIMEOUT = settings .LARGE_TIMEOUT
1554
1554
sb_config .pytest_html_report = config .getoption ("htmlpath" ) # --html=FILE
1555
+ sb_config ._sb_class = None # (Used with the sb fixture for "--rcs")
1555
1556
sb_config ._sb_node = {} # sb node dictionary (Used with the sb fixture)
1556
1557
# Dashboard-specific variables
1557
1558
sb_config ._results = {} # SBase Dashboard test results
@@ -2178,6 +2179,7 @@ def sb(request):
2178
2179
Usage example: "def test_one(sb):"
2179
2180
You may need to use this for tests that use other pytest fixtures."""
2180
2181
from seleniumbase import BaseCase
2182
+ from seleniumbase .core import session_helper
2181
2183
2182
2184
class BaseClass (BaseCase ):
2183
2185
def setUp (self ):
@@ -2191,6 +2193,11 @@ def base_method(self):
2191
2193
pass
2192
2194
2193
2195
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
2194
2201
request .cls .sb = BaseClass ("base_method" )
2195
2202
request .cls .sb .setUp ()
2196
2203
request .cls .sb ._needs_tearDown = True
You can’t perform that action at this time.
0 commit comments