[pytest-dev] test_pdb.py hangs in PyCharm 4.5

Omar Kohl omarkohl at gmail.com
Sat Jul 25 15:26:09 CEST 2015


I tried running the py.test tests in PyCharm and
'test_pdb_collection_failure_is_shown()' from the test_pdb.py module simply
hangs and stops execution.

Playing around I found this is because PyCharm disables output capturing
(probably because they want to capture it themselves).

It can be reproduced easily without PyCharm:

    py.test -s testing/test_pdb.py

Then one can type 'c' (continue in pdb)  - even though no output is shown
regarding pdb - and the test run finishes.

Following is the default command executed by PyCharm to run the test:

    python3 /opt/pycharm-community-4.5.2/helpers/pycharm/pytestrunner.py -p
pytest_teamcity testing/test_pdb.py --capture=sys

To verify that the problem is as described TWO things need to be done:
1. Remove the --capture=sys from the command (or replace with --capture=fd)
2. Comment out line 25 in pytestrunner.py (args.append("-s") if "-s" not in
args else None

Any suggestion on what can be done to fix this? Can/should I open an issue?

In a way it could be seen as a PyCharm problem, but I can see why they
would want to prevent output capturing to be able to do this themselves in
their console. On the other hand it also happens when running the test on
the console having disabled capturing (-s).

Is it possible/reasonable to fail or skip the test if it is detected that
output is not being captured? (Remember currently it just freezes, which I
think is very confusing!).

In any case this mail should serve as documentation to anyone having
trouble with this issue: Just ignore the test and run it manually outside
PyCharm would be my recommendation.

Kind regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20150725/29eb46ef/attachment.html>

More information about the pytest-dev mailing list