While running py.test with --pdb and pyreadline installed once the pdb pops up no input can be entered. The prompt is non-responsive.
This seems related to the fix related to pyreadline that was added. Commenting out the import readline makes this work again.
Maybe the fix that was added is also dependent on the Python version used, the behaviour of readline initialization in Python might be different. Or maybe this fix fixed a different bug with pyreadline integration.
Python 2.7.8, pyreadline 2.1, py.test 2.8.7
there indeed ws an issue fixed by #1281
@embray @nicoddemus can you verify the problem @temp4746 is seeing independently?
i fear we indeed need to add a more detailed version check
@temp4746 can you take a look if it happens with the latest python of the 2.7 series
It's possible this is a different but related issue, since the bug I fixed actually caused an infinite output of Python tracebacks, rather than just a frozen prompt. But it's entirely possible more work is needed (though I suspect it's more an issue with pyreadline than with pytest).
Oops sorry I missed this. I will try to reproduce the problem tonight.
Sorry for not replying earlier!
I couldn't reproduce it here:
============================= test session starts =============================
platform win32 -- Python 2.7.10, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: X:\pytest, inifile: tox.ini
collected 1 items
foo.py F
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
def test():
> assert 0
E assert 0
foo.py:2: AssertionError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> x:\pytest\foo.py(2)test()
-> assert 0
(Pdb) quit
Here's my environment:
colorama (0.3.6)
pip (7.1.0)
py (1.4.31)
pyreadline (2.1)
pytest (2.8.7, x:\pytest)
setuptools (18.0.1)
wheel (0.24.0)
(I also tried with pytest-2.8.6 and current master).
Could you post similar information about your environment @temp4746?
Reproduced on a clean virtualenv (Python 2.7.11) with the following only:
colorama (0.3.6)
decorator (4.0.9)
ipython (4.1.1)
ipython-genutils (0.1.0)
path.py (8.1.2)
pickleshare (0.6)
pip (8.0.2)
py (1.4.31)
pyreadline (2.1)
pytest (2.8.7)
setuptools (20.1.1)
simplegeneric (0.8.1)
traitlets (4.1.0)
wheel (0.29.0)
Using this test file (Named test.py):
def test_x():
assert False
Running py.test like this: py.test --pdb test.py
@temp4746 sorry but I still can't reproduce it in my home computer... which shell are you using? Plain cmd.exe?
I will try to reproduce this tomorrow at work.
Plain old cmd.exe (Note that I'm using Windows 7 so not the revamped cmd.exe in Windows 10)
Hmmm at home I'm using Windows 10 (cmd.exe was revamped in Windows 10? Didn't notice :stuck_out_tongue_winking_eye:)
I completely forgot to try this at work, I use Windows 7 in there. Will try this tomorrow (for real this time).
Hmmm I could reproduce this in Windows 7... not sure when I will be able to tackle it though.
Win7 x64, py.test 2.9.2, pyreadline 2.1, python 2.7.10 x32. Have the same problem. Tried to comment line with _readline_workaround() in the _pytest/capture.py:pytest_load_initial_conftests and it works for me now, I have possibility to work with py.tests and PDB. It seems that I miss something important, but I haven't noticed it yet)
Weird. So #1281 fixes pdb for some people, but breaks it for others?
Same conclusion as @maliavko for me: commenting out _readline_workaround() makes the debugger works when using --pdb.
Windows 7 x64, regular cmd.exe console, Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
Same issue. If it can help anyone, another workaround (without modifying source) would be to use temporarily sys level capturing: py.test test_file.py --pdb --capture=sys
Windows 7 x64, regular cmd.exe console, Python 2.7.12 (anaconda), pytest-3.0.2
Same issue for me (although I swear it worked once, in a virtualenv, but I just can't remember which!).
the workaround by @zadamah works for me, and instead of --capture=sys I can just use -s (shortcut for --capture=no)
py.test -s --pdb test_file.py
My system:
thanks for creating such awesome _free_ software! :heart:
Closing this issue as both Python 2 and Windows 7 have passed their end-of-life dates.
Most helpful comment
Same issue. If it can help anyone, another workaround (without modifying source) would be to use temporarily sys level capturing:
py.test test_file.py --pdb --capture=sysWindows 7 x64, regular cmd.exe console, Python 2.7.12 (anaconda), pytest-3.0.2