Pycharm unit test interactive debug command line doesn’t work

This is likely because your test runner is capturing stdout but not stderr.

I use py.test which captures both stdout and stderr so I see no output at all. If I want to see output I have to pass the -s flag to my py.test runner which can be done by modifying the run/debug configuration and adding this flag to the options field.
(Run > Edit Configurations > Defaults > Python tests > py.test > add -s to the “additional arguments” field.)

>>> print 'a'
a
>>> import sys
>>> sys.stderr.write('moof')
moof
>>> sys.stdout.write('moof')
moof
>>> sys.stderr.write('test')
test

Note: the -s flag can equally be used with nose tests

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)