serhii.net

In the middle of the desert you can say anything you want

09 Aug 2022

Pycharm pytest logging settings

Pytest logging in pycharm

In Pycharm running config, there are options to watch individual log files which is nice.

But the main bit - all my logging issues etc. were the fault of Pycharm’s Settings for pytest that added automatically a -q flag. Removed that checkmark and now I get standard pytest output that I can modify!

And now caplog1 works:

def test_split_ds(caplog):
    caplog.set_level(logging.DEBUG, logger="anhaltai_bbk.data.train_dev_splitter.splitter")
    caplog.set_level(logging.DEBUG)
	# ...

Dropping into debugger on uncaught exception + pytest plugin

So, previously I thought about this here: 220214-1756 python run pdb on exception

Anyway, solution was on pytest level, installing this package was the only thing needed: pytest-pycharm · PyPI

Installed it at the same time as this pycharm plugin, might’ve been either of the two:

pytest imp - IntelliJ IDEA & PyCharm Plugin | Marketplace / theY4Kman/pycharm-pytest-imp: PyCharm pytest improvements plugin

Anyway now life’s good:

2022-08-09-212556_500x165_scrot.png

Nel mezzo del deserto posso dire tutto quello che voglio.