|
1 | 1 | import collections
|
2 | 2 | import pdb
|
3 |
| -import shutil |
| 3 | +try: |
| 4 | + import pdbp # (Pdb+) --- Python Debugger Plus |
| 5 | +except Exception: |
| 6 | + pass |
4 | 7 | import sys
|
5 | 8 | from selenium import webdriver
|
6 | 9 | from seleniumbase.__version__ import __version__
|
|
16 | 19 | from seleniumbase.plugins.driver_manager import Driver # noqa
|
17 | 20 | from seleniumbase.plugins.driver_manager import DriverContext # noqa
|
18 | 21 |
|
19 |
| -if hasattr(pdb, "DefaultConfig"): |
20 |
| - # Only load pdbpp configuration if pdbpp is installed |
21 |
| - pdb.DefaultConfig.filename_color = pdb.Color.blue |
22 |
| - pdb.DefaultConfig.line_number_color = pdb.Color.turquoise |
23 |
| - pdb.DefaultConfig.show_hidden_frames_count = False |
24 |
| - pdb.DefaultConfig.disable_pytest_capturing = True |
25 |
| - pdb.DefaultConfig.enable_hidden_frames = False |
26 |
| - pdb.DefaultConfig.truncate_long_lines = True |
27 |
| - pdb.DefaultConfig.sticky_by_default = True |
28 |
| - # Fix spacing for line numbers > 9999 |
29 |
| - pdb.Pdb.get_terminal_size = lambda x: ( |
30 |
| - shutil.get_terminal_size()[0] - 1, |
31 |
| - shutil.get_terminal_size()[1], |
32 |
| - ) |
| 22 | +if sys.version_info[0] < 3 and "pdbp" in locals(): |
| 23 | + # With Python3, "import pdbp" is all you need |
| 24 | + for key in pdbp.__dict__.keys(): |
| 25 | + # Replace pdb with pdbp |
| 26 | + pdb.__dict__[key] = pdbp.__dict__[key] |
| 27 | + if hasattr(pdb, "DefaultConfig"): |
| 28 | + # Here's how to customize Pdb+ options |
| 29 | + pdb.DefaultConfig.filename_color = pdb.Color.blue |
| 30 | + pdb.DefaultConfig.line_number_color = pdb.Color.turquoise |
| 31 | + pdb.DefaultConfig.show_hidden_frames_count = False |
| 32 | + pdb.DefaultConfig.disable_pytest_capturing = True |
| 33 | + pdb.DefaultConfig.enable_hidden_frames = False |
| 34 | + pdb.DefaultConfig.truncate_long_lines = True |
| 35 | + pdb.DefaultConfig.sticky_by_default = True |
33 | 36 | if sys.version_info[0] >= 3:
|
34 | 37 | from seleniumbase import translate # noqa
|
35 | 38 | if sys.version_info >= (3, 7):
|
|
0 commit comments