console output for unittest

Answered

I recently upgraded Python to 3.6.1 and Pycharm to 2017, and when I put a breakpoint inside a unittest in Pycharm and try to execute a command in the console I don't get any output at all.

In the console there are some lines starting with "teamcity", including one that says the following:

##teamcity[testStarted timestamp='2017-06-21T15:02:20.934' captureStandardOutput='true'

Does this have something to do with now showing standard output? If I write to stderr I don't see anything either.

How do I adjust things to see output in the console window?

 

9 comments

Hi Ergannan! Which test runner do you use? Could you please set JB_DISABLE_BUFFERING environment variable in the Test Run Configuration? Has it helped?

0

Sorry, I searched for but didn't see the other topic that you linked to. I can reply there if that would keep things in one place...

I'm using unittest as the test runner.

I tried setting the JB_DISABLE_BUFFERING environment variable, but it didn't seem to make any difference. The strange thing, is that in testing this, in some functions I see output from the console, and in others I don't. I don't see any obvious difference between the functions, but it's totally reproducible.

 

0

I see, could you please specify what exact PyCharm version are you using?

0

Yes it's:

PyCharm Community Edition 2017.1.4 

Build #PC-171.4694.38, built on June 13, 2017
JRE: 1.8.0_112-release-736-b21 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7 6.1

and I'm using Python 3.6.1

0

Ok, thank you! Looks like we have a regression bug on our side, I created a ticket for this problem in our tracker, please follow: PY-24875.

0

This is preventing my colleagues and I from doing proper debugging. The debug console is one of my most used tools. Please can you add some extra information into the ticket to explain that the debug console is now effectively broken? Thanks.

0

Same issue here when using unittest library

PyCharm Community Edition 2017.2

Build #PC-172.3317.103

python 3.6.2

Mac OSX Sierra 10.12.5

0

It may not be optimal, but, assuming you wanted to print the value of `x` you cold also do something like this:

    assertTrue(false, x) 

That way, the assertion will fail and cause `x` to be printed.

0

Please sign in to leave a comment.