Skip to content

Commit

Permalink
Merge pull request #3178 from seleniumbase/console-scripts-and-colors
Browse files Browse the repository at this point in the history
Update console scripts and color settings
  • Loading branch information
mdmintz authored Oct 6, 2024
2 parents e17ce80 + 3dda9db commit f9e4f64
Show file tree
Hide file tree
Showing 22 changed files with 502 additions and 623 deletions.
8 changes: 0 additions & 8 deletions examples/test_chromedriver.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""This test is only for Chrome!
(Verify that your chromedriver is compatible with your version of Chrome.)"""
import colorama
import sys
from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)

Expand All @@ -16,13 +15,6 @@ def test_chromedriver_matches_chrome(self):
major_chrome_version = chrome_version.split(".")[0]
chromedriver_version = self.get_chromedriver_version()
major_chromedriver_version = chromedriver_version.split(".")[0]
if (
"win32" in sys.platform
and hasattr(colorama, "just_fix_windows_console")
):
colorama.just_fix_windows_console()
else:
colorama.init(autoreset=True)
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
c3 = colorama.Fore.BLUE + colorama.Back.LIGHTYELLOW_EX
Expand Down
20 changes: 14 additions & 6 deletions seleniumbase/__init__.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
import collections
import os
import pdb
try:
import pdbp # (Pdb+) --- Python Debugger Plus
except Exception:
pass
import sys
from contextlib import suppress
from selenium import webdriver
from seleniumbase.__version__ import __version__
from seleniumbase.common import decorators # noqa
from seleniumbase.common import encryption # noqa
from seleniumbase.core import colored_traceback # noqa
from seleniumbase.core import colored_traceback
from seleniumbase.core.browser_launcher import get_driver # noqa
from seleniumbase.fixtures import js_utils # noqa
from seleniumbase.fixtures import page_actions # noqa
from seleniumbase.fixtures import page_utils # noqa
from seleniumbase.fixtures import shared_utils # noqa
from seleniumbase.fixtures import shared_utils
from seleniumbase.fixtures.base_case import BaseCase # noqa
from seleniumbase.masterqa.master_qa import MasterQA # noqa
from seleniumbase.plugins.sb_manager import SB # noqa
from seleniumbase.plugins.driver_manager import Driver # noqa
from seleniumbase.plugins.driver_manager import DriverContext # noqa
from seleniumbase import translate # noqa

with suppress(Exception):
import colorama
import pdbp # (Pdb+) --- Python Debugger Plus

is_windows = shared_utils.is_windows()
with suppress(Exception):
if is_windows and hasattr(colorama, "just_fix_windows_console"):
colorama.just_fix_windows_console()
elif not shared_utils.is_linux():
colorama.init(autoreset=True)

if sys.version_info[0] < 3 and "pdbp" in locals():
# With Python3, "import pdbp" is all you need
for key in pdbp.__dict__.keys():
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.31.4"
__version__ = "4.31.5"
8 changes: 0 additions & 8 deletions seleniumbase/behave/behave_sb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1231,10 +1231,6 @@ def behave_dashboard_prepare():
c1 = ""
cr = ""
if not is_linux:
if is_windows and hasattr(colorama, "just_fix_windows_console"):
colorama.just_fix_windows_console()
else:
colorama.init(autoreset=True)
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
cr = colorama.Style.RESET_ALL
print("Dashboard: %s%s%s\n%s" % (c1, dash_path, cr, stars))
Expand Down Expand Up @@ -1346,10 +1342,6 @@ def _perform_behave_terminal_summary_():
c2 = ""
cr = ""
if not is_linux:
if is_windows and hasattr(colorama, "just_fix_windows_console"):
colorama.just_fix_windows_console()
else:
colorama.init(autoreset=True)
c2 = colorama.Fore.MAGENTA + colorama.Back.LIGHTYELLOW_EX
cr = colorama.Style.RESET_ALL
if sb_config.dashboard:
Expand Down
8 changes: 0 additions & 8 deletions seleniumbase/console_scripts/logo_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import colorama
import os
import sys
from contextlib import suppress

r"""
Expand All @@ -17,13 +16,6 @@


def get_seleniumbase_logo():
if (
"win32" in sys.platform
and hasattr(colorama, "just_fix_windows_console")
):
colorama.just_fix_windows_console()
else:
colorama.init(autoreset=True)
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
c3 = colorama.Back.CYAN
Expand Down
Loading

0 comments on commit f9e4f64

Please sign in to comment.