Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f9e4f64

Browse files
authored
Merge pull request #3178 from seleniumbase/console-scripts-and-colors
Update console scripts and color settings
2 parents e17ce80 + 3dda9db commit f9e4f64

22 files changed

+502
-623
lines changed

‎examples/test_chromedriver.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""This test is only for Chrome!
22
(Verify that your chromedriver is compatible with your version of Chrome.)"""
33
import colorama
4-
import sys
54
from seleniumbase import BaseCase
65
BaseCase.main(__name__, __file__)
76

@@ -16,13 +15,6 @@ def test_chromedriver_matches_chrome(self):
1615
major_chrome_version = chrome_version.split(".")[0]
1716
chromedriver_version = self.get_chromedriver_version()
1817
major_chromedriver_version = chromedriver_version.split(".")[0]
19-
if (
20-
"win32" in sys.platform
21-
and hasattr(colorama, "just_fix_windows_console")
22-
):
23-
colorama.just_fix_windows_console()
24-
else:
25-
colorama.init(autoreset=True)
2618
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
2719
c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
2820
c3 = colorama.Fore.BLUE + colorama.Back.LIGHTYELLOW_EX

‎seleniumbase/__init__.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
11
import collections
22
import os
33
import pdb
4-
try:
5-
import pdbp # (Pdb+) --- Python Debugger Plus
6-
except Exception:
7-
pass
84
import sys
5+
from contextlib import suppress
96
from selenium import webdriver
107
from seleniumbase.__version__ import __version__
118
from seleniumbase.common import decorators # noqa
129
from seleniumbase.common import encryption # noqa
13-
from seleniumbase.core import colored_traceback# noqa
10+
from seleniumbase.core import colored_traceback
1411
from seleniumbase.core.browser_launcher import get_driver # noqa
1512
from seleniumbase.fixtures import js_utils # noqa
1613
from seleniumbase.fixtures import page_actions # noqa
1714
from seleniumbase.fixtures import page_utils # noqa
18-
from seleniumbase.fixtures import shared_utils# noqa
15+
from seleniumbase.fixtures import shared_utils
1916
from seleniumbase.fixtures.base_case import BaseCase # noqa
2017
from seleniumbase.masterqa.master_qa import MasterQA # noqa
2118
from seleniumbase.plugins.sb_manager import SB # noqa
2219
from seleniumbase.plugins.driver_manager import Driver # noqa
2320
from seleniumbase.plugins.driver_manager import DriverContext # noqa
2421
from seleniumbase import translate # noqa
2522

23+
with suppress(Exception):
24+
import colorama
25+
import pdbp # (Pdb+) --- Python Debugger Plus
26+
27+
is_windows = shared_utils.is_windows()
28+
with suppress(Exception):
29+
if is_windows and hasattr(colorama, "just_fix_windows_console"):
30+
colorama.just_fix_windows_console()
31+
elif not shared_utils.is_linux():
32+
colorama.init(autoreset=True)
33+
2634
if sys.version_info[0] < 3 and "pdbp" in locals():
2735
# With Python3, "import pdbp" is all you need
2836
for key in pdbp.__dict__.keys():

‎seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "4.31.4"
2+
__version__ = "4.31.5"

‎seleniumbase/behave/behave_sb.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,10 +1231,6 @@ def behave_dashboard_prepare():
12311231
c1 = ""
12321232
cr = ""
12331233
if not is_linux:
1234-
if is_windows and hasattr(colorama, "just_fix_windows_console"):
1235-
colorama.just_fix_windows_console()
1236-
else:
1237-
colorama.init(autoreset=True)
12381234
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
12391235
cr = colorama.Style.RESET_ALL
12401236
print("Dashboard: %s%s%s\n%s" % (c1, dash_path, cr, stars))
@@ -1346,10 +1342,6 @@ def _perform_behave_terminal_summary_():
13461342
c2 = ""
13471343
cr = ""
13481344
if not is_linux:
1349-
if is_windows and hasattr(colorama, "just_fix_windows_console"):
1350-
colorama.just_fix_windows_console()
1351-
else:
1352-
colorama.init(autoreset=True)
13531345
c2 = colorama.Fore.MAGENTA + colorama.Back.LIGHTYELLOW_EX
13541346
cr = colorama.Style.RESET_ALL
13551347
if sb_config.dashboard:

‎seleniumbase/console_scripts/logo_helper.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import colorama
66
import os
7-
import sys
87
from contextlib import suppress
98

109
r"""
@@ -17,13 +16,6 @@
1716

1817

1918
def get_seleniumbase_logo():
20-
if (
21-
"win32" in sys.platform
22-
and hasattr(colorama, "just_fix_windows_console")
23-
):
24-
colorama.just_fix_windows_console()
25-
else:
26-
colorama.init(autoreset=True)
2719
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
2820
c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
2921
c3 = colorama.Back.CYAN

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /