Skip to content

Commit bdac9d3

Browse files
committed
tests: improve test_pdb_interaction_doctest
- ignore pdbrc (might be done in general, but this was the only affected test) - fail faster in case of unexpected failure
1 parent 37158f5 commit bdac9d3

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

testing/test_pdb.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def test_2():
457457
child.read()
458458
self.flush(child)
459459

460-
def test_pdb_interaction_doctest(self, testdir):
460+
def test_pdb_interaction_doctest(self, testdir, monkeypatch):
461461
p1 = testdir.makepyfile(
462462
"""
463463
import pytest
@@ -468,11 +468,18 @@ def function_1():
468468
'''
469469
"""
470470
)
471+
# Prevent ~/.pdbrc etc to output anything.
472+
monkeypatch.setenv("HOME", str(testdir))
473+
471474
child = testdir.spawn_pytest("--doctest-modules --pdb %s" % p1)
472475
child.expect("Pdb")
473-
child.sendline("i")
474-
child.expect("0")
476+
477+
assert "UNEXPECTED EXCEPTION: AssertionError()" in child.before.decode("utf8")
478+
479+
child.sendline("'i=%i.' % i")
475480
child.expect("Pdb")
481+
assert "\r\n'i=0.'\r\n" in child.before.decode("utf8")
482+
476483
child.sendeof()
477484
rest = child.read().decode("utf8")
478485
assert "1 failed" in rest

0 commit comments

Comments
 (0)