111
111
from seleniumbase .fixtures import constants
112
112
from seleniumbase .fixtures import shared_utils
113
113
114
+ is_linux = shared_utils .is_linux ()
115
+ is_windows = shared_utils .is_windows ()
114
116
sb_config .__base_class = None
115
117
116
118
@@ -829,10 +831,10 @@ def get_configured_sb(context):
829
831
'\n (Your browser choice was: "%s")\n ' % sb .browser
830
832
)
831
833
# The Xvfb virtual display server is for Linux OS Only.
832
- if sb .xvfb and not shared_utils . is_linux () :
834
+ if sb .xvfb and not is_linux :
833
835
sb .xvfb = False
834
836
if (
835
- shared_utils . is_linux ()
837
+ is_linux
836
838
and not sb .headed
837
839
and not sb .headless
838
840
and not sb .headless2
@@ -1020,7 +1022,7 @@ def dashboard_pre_processing():
1020
1022
filename = None
1021
1023
feature_name = None
1022
1024
scenario_name = None
1023
- if shared_utils . is_windows () :
1025
+ if is_windows :
1024
1026
output = output .decode ("latin1" )
1025
1027
else :
1026
1028
output = output .decode ("utf-8" )
@@ -1129,8 +1131,11 @@ def behave_dashboard_prepare():
1129
1131
stars = "*" * star_len
1130
1132
c1 = ""
1131
1133
cr = ""
1132
- if not shared_utils .is_linux ():
1133
- colorama .init (autoreset = True )
1134
+ if not is_linux :
1135
+ if is_windows and hasattr (colorama , "just_fix_windows_console" ):
1136
+ colorama .just_fix_windows_console ()
1137
+ else :
1138
+ colorama .init (autoreset = True )
1134
1139
c1 = colorama .Fore .BLUE + colorama .Back .LIGHTCYAN_EX
1135
1140
cr = colorama .Style .RESET_ALL
1136
1141
print ("Dashboard: %s%s%s\n %s" % (c1 , dash_path , cr , stars ))
@@ -1144,7 +1149,7 @@ def _perform_behave_unconfigure_():
1144
1149
if sb_config .shared_driver :
1145
1150
try :
1146
1151
if (
1147
- not shared_utils . is_windows ()
1152
+ not is_windows
1148
1153
or sb_config .browser == "ie"
1149
1154
or sb_config .shared_driver .service .process
1150
1155
):
@@ -1221,7 +1226,7 @@ def do_final_driver_cleanup_as_needed():
1221
1226
try :
1222
1227
if hasattr (sb_config , "last_driver" ) and sb_config .last_driver :
1223
1228
if (
1224
- not shared_utils . is_windows ()
1229
+ not is_windows
1225
1230
or sb_config .browser == "ie"
1226
1231
or sb_config .last_driver .service .process
1227
1232
):
@@ -1245,8 +1250,11 @@ def _perform_behave_terminal_summary_():
1245
1250
equals = "=" * (equals_len + 2 )
1246
1251
c2 = ""
1247
1252
cr = ""
1248
- if not shared_utils .is_linux ():
1249
- colorama .init (autoreset = True )
1253
+ if not is_linux :
1254
+ if is_windows and hasattr (colorama , "just_fix_windows_console" ):
1255
+ colorama .just_fix_windows_console ()
1256
+ else :
1257
+ colorama .init (autoreset = True )
1250
1258
c2 = colorama .Fore .MAGENTA + colorama .Back .LIGHTYELLOW_EX
1251
1259
cr = colorama .Style .RESET_ALL
1252
1260
if sb_config .dashboard :
0 commit comments