How to view standard output from PyCharm unit tests (being swallowed?)

Answered

Recently upgraded to PyCharm 2017.1

Debugging some unit tests, I can no longer see anything in the console. I wonder if stdout is now swallowed, and if so how do I prevent that?

If I simply type print(1) in the console while debugging, nothing is printed. Makes it hard to debug more complex structures if I can't poke around at them on the console.

I notice new boilerplate at the top of each test run now, maybe I have fiddle with TeamCity settings? (I was not aware I even purchased TeamCity).

It looks like it might be capturing standard output now in the latest release of PyCharm. I'm not able to find a setting to switch this off.

##teamcity[enteredTheMatrix timestamp='2017-04-11T10:54:01.978']
Launching unittests with arguments python -m unittest weather.TestLoadHourlySaveDaily.TestLoadHourlySaveDaily.test_load_wsi_raw_forecasts
##teamcity[testSuiteStarted timestamp='2017-04-11T10:54:03.487' locationHint='python://weather' name='weather' nodeId='1' parentNodeId='0']
##teamcity[testSuiteStarted timestamp='2017-04-11T10:54:03.487' locationHint='python://weather.TestLoadHourlySaveDaily' name='TestLoadHourlySaveDaily' nodeId='2' parentNodeId='1']
##teamcity[testSuiteStarted timestamp='2017-04-11T10:54:03.488' locationHint='python://weather.TestLoadHourlySaveDaily.TestLoadHourlySaveDaily' name='TestLoadHourlySaveDaily' nodeId='3' parentNodeId='2']
##teamcity[testStarted timestamp='2017-04-11T10:54:03.488' captureStandardOutput='true' locationHint='python://weather.TestLoadHourlySaveDaily.TestLoadHourlySaveDaily.test_load_wsi_raw_forecasts' name='test_load_wsi_raw_forecasts' nodeId='4' parentNodeId='3']

Does this spell the end of debugging unit tests when they fail? I sure hope not!

Thanks for your help.

2 comments
Comment actions Permalink

Short version, define environment variable JB_DISABLE_BUFFERING

The working link (to the issue in some inscrutable status): https://youtrack.jetbrains.com/issue/PY-22505

0

Please sign in to leave a comment.