File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -457,7 +457,7 @@ def test_2():
457
457
child .read ()
458
458
self .flush (child )
459
459
460
- def test_pdb_interaction_doctest (self , testdir ):
460
+ def test_pdb_interaction_doctest (self , testdir , monkeypatch ):
461
461
p1 = testdir .makepyfile (
462
462
"""
463
463
import pytest
@@ -468,11 +468,18 @@ def function_1():
468
468
'''
469
469
"""
470
470
)
471
+ # Prevent ~/.pdbrc etc to output anything.
472
+ monkeypatch .setenv ("HOME" , str (testdir ))
473
+
471
474
child = testdir .spawn_pytest ("--doctest-modules --pdb %s" % p1 )
472
475
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" )
475
480
child .expect ("Pdb" )
481
+ assert "\r \n 'i=0.'\r \n " in child .before .decode ("utf8" )
482
+
476
483
child .sendeof ()
477
484
rest = child .read ().decode ("utf8" )
478
485
assert "1 failed" in rest
You can’t perform that action at this time.
0 commit comments