Skip to content

Commit cbeb8dc

Browse files
committed
breakpoint() is the recommended debugging tool
1 parent 95f1fcc commit cbeb8dc

File tree

6 files changed

+7
-13
lines changed

6 files changed

+7
-13
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,6 @@ import time; time.sleep(3) # Do nothing for 3 seconds.
617617
🔵 **Debug Mode** with Python's built-in **[pdb](https://docs.python.org/3/library/pdb.html)** library helps you debug tests:
618618
619619
```python
620-
import pdb; pdb.set_trace()
621-
import pytest; pytest.set_trace()
622620
breakpoint() # Shortcut for "import pdb; pdb.set_trace()"
623621
```
624622

help_docs/customizing_test_runs.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,10 @@ pytest --reruns=1 --reruns-delay=1
294294

295295
<h3><img src="https://seleniumbase.github.io/img/green_logo.png" title="SeleniumBase" width="32" /> Debugging tests:</h3>
296296

297-
🔵 You can use the following calls in your scripts to help you debug issues:
297+
🔵 Use `breakpoint()` in your scripts to help you debug issues:
298298

299299
```python
300-
import time; time.sleep(5) # Makes the test wait and do nothing for 5 seconds.
301-
import pdb; pdb.set_trace() # Debug Mode. n: next, c: continue, s: step, u: up, d: down.
302-
import pytest; pytest.set_trace() # Debug Mode. n: next, c: continue, s: step, u: up, d: down.
300+
breakpoint() # Debug Mode. n: next, c: continue, s: step, u: up, d: down.
303301
```
304302

305303
🔵 To pause an active test that throws an exception or error, (*and keep the browser window open while **Debug Mode** begins in the console*), add **`--pdb`** as a `pytest` option:

help_docs/recorder_mode.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pytest new_test.py --rec -q -s --url=wikipedia.org
3636
6 if self.recorder_ext:
3737
7 # When done recording actions,
3838
8 # type "c", and press [Enter].
39-
9 -> import pdb; pdb.set_trace()
39+
9 -> breakpoint()
4040
return None
4141
(Pdb+) c
4242

@@ -80,7 +80,7 @@ The first command creates a boilerplate test with a breakpoint; the second comma
8080
⏺️ You can also use the Recorder to add code to an existing test. To do that, you'll first need to create a breakpoint in your code to insert manual browser actions:
8181
8282
```python
83-
import pdb; pdb.set_trace()
83+
breakpoint()
8484
```
8585
8686
Now you'll be able to run your test with ``pytest``, and it will stop at the breakpoint for you to add in actions: (Press ``c`` and ``ENTER`` on the command-line to continue from the breakpoint.)

seleniumbase/console_scripts/sb_mkfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def main():
277277
data.append(' self.open("%s")' % url)
278278
else:
279279
data.append(" if self.recorder_ext and not self.xvfb:")
280-
data.append(" import pdb; pdb.set_trace()")
280+
data.append(" breakpoint()")
281281
if not basic and not recorder:
282282
data.append(
283283
' self.type("input", "%s")' " # selector, text" % goodbye

seleniumbase/console_scripts/sb_mkrec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def main():
216216
data.append(" if self.recorder_ext:")
217217
data.append(" # When done recording actions,")
218218
data.append(' # type "c", and press [Enter].')
219-
data.append(" import pdb; pdb.set_trace()")
219+
data.append(" breakpoint()")
220220
data.append("")
221221

222222
if esc_end:

seleniumbase/plugins/sb_manager.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,9 +1408,7 @@ def SB(
14081408
test_passed = True # This can change later
14091409
teardown_exception = None
14101410
if "--trace" in sys_argv:
1411-
import pdb
1412-
1413-
pdb.set_trace() # Debug Mode
1411+
breakpoint() # Debug Mode
14141412
# Type "s" and press [Enter] to step into "yield sb".
14151413
try:
14161414
yield sb

0 commit comments

Comments
 (0)