I\'m sure this is a simple fix, but I\'d like to view log messages in the PyCharm console while running a unit test. The modules I\'m testing have their own loggers, an
I experienced this problem all of a sudden after updating Pycharm. I had been running my tests with the Unittest
runner, and all of a sudden Pycharm decided the default should be the pytest
runner. When I changed the default test runner back to Unittest
the logs appeared as I expected they would.
You can change the default test runner in Project Settings/Preferences >> Tools >> Python Integrated Tools
I assume adding the -nologcapture
flag as noted in other answers probably would have worked in my case as well, but I prefer a solution that's exposed by the IDE rather than a manual override.
BTW choosing Unittest
also solves an additional error that I got once when trying to run tests - No module named 'nose'