Skip to content

Windows pdb while capturing is broken since 2.8.6 #1388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
temp4746 opened this issue Feb 15, 2016 · 15 comments
Closed

Windows pdb while capturing is broken since 2.8.6 #1388

temp4746 opened this issue Feb 15, 2016 · 15 comments
Labels
platform: windows windows platform-specific problem plugin: debugging related to the debugging builtin plugin type: bug problem that needs to be addressed

Comments

@temp4746
Copy link

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

@RonnyPfannschmidt
Copy link
Member

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

@embray
Copy link
Contributor

embray commented Feb 15, 2016

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).

@nicoddemus
Copy link
Member

Oops sorry I missed this. I will try to reproduce the problem tonight.

@nicoddemus
Copy link
Member

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?

@temp4746
Copy link
Author

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

@nicoddemus
Copy link
Member

@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.

@temp4746
Copy link
Author

Plain old cmd.exe (Note that I'm using Windows 7 so not the revamped cmd.exe in Windows 10)

@nicoddemus
Copy link
Member

Hmmm at home I'm using Windows 10 (cmd.exe was revamped in Windows 10? Didn't notice 😜)

I completely forgot to try this at work, I use Windows 7 in there. Will try this tomorrow (for real this time).

@nicoddemus
Copy link
Member

Hmmm I could reproduce this in Windows 7... not sure when I will be able to tackle it though.

@maliavko
Copy link

maliavko commented Jun 3, 2016

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)

@embray
Copy link
Contributor

embray commented Jun 7, 2016

Weird. So #1281 fixes pdb for some people, but breaks it for others?

@nbud
Copy link

nbud commented Aug 1, 2016

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

@zadamah
Copy link

zadamah commented Sep 5, 2016

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

@mikofski
Copy link

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:

  • OS: Windows 7 x64
  • shell: cmd or msys2/gitbash (in both cmd or conemu)
  • Python: v2.7.12 from python.org (not anaconda)
  • PyTest: v3.0.6

thanks for creating such awesome free software! ❤️

@Zac-HD Zac-HD added type: bug problem that needs to be addressed platform: windows windows platform-specific problem plugin: debugging related to the debugging builtin plugin labels Oct 20, 2018
@Zac-HD
Copy link
Member

Zac-HD commented Jan 24, 2020

Closing this issue as both Python 2 and Windows 7 have passed their end-of-life dates.

@Zac-HD Zac-HD closed this as completed Jan 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: windows windows platform-specific problem plugin: debugging related to the debugging builtin plugin type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

9 participants