我使用import unittest創建了unitests。當我想運行一個特定的測試,然後放置一個斷點,然後轉到控制檯並嘗試評估表達式沒有返回值,就好像stdout不再是控制檯屏幕一樣。pycharm中單元測試控制檯無輸出2017
我從來沒有安裝teamcity,但奇怪的是我運行unittest時會收到消息。很奇怪。我認爲這可能是captureStandardOutput ='true'(在最後一行強調,下面)是問題的原因,但我什至不能找到在哪裏更改參數來測試它。
C:\Users\selas\AppData\Local\Continuum\Anaconda3\python.exe "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2017.1\helpers\pydev\pydevd.py" --multiproc --qt-support --client 127.0.0.1 --port 59641 --file "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2017.1\helpers\pycharm\_jb_unittest_runner.py" --target tests.test_model.FigurationDBTesting.test_printFigurationPerBoundary
pydev debugger: process 8932 is connecting
Connected to pydev debugger (build 171.3780.115)
teamcity[enteredTheMatrix timestamp='...']
Launching unittests with arguments python -m unittest tests.test_model.FigurationDBTesting.test_printFigurationPerBoundary
teamcity[testSuiteStarted timestamp='...' locationHint='python://tests' name='tests' nodeId='1' parentNodeId='0']
teamcity[testSuiteStarted timestamp='...' locationHint='python://tests.test_model' name='test_model' nodeId='2' parentNodeId='1']
teamcity[testSuiteStarted timestamp='...' locationHint='python://tests.test_model.FigurationDBTesting' name='FigurationDBTesting' nodeId='3' parentNodeId='2']
teamcity[testStarted timestamp='...' >!> captureStandardOutput='true' <!< locationHint='python://tests.test_model.FigurationDBTesting.test_printFigurationPerBoundary' name='test_printFigurationPerBoundary' nodeId='4' parentNodeId='3']
你可以嘗試編輯'''助手/ pycharm/TeamCity的/ unittestpy.py'''(在PyCharm.app包在我的Mac上,不確定它在Windows中的位置)。我把它改成'''captureStandardOutput ='false''''並且調試器以我的修改值開始,但是它的結果是一樣的: –