theY4Kman / pycharm-pytest-imp

PyCharm pytest improvements plugin
https://plugins.jetbrains.com/plugin/14202-pytest-imp/
17 stars 2 forks source link

pytest imp plugin is not picking up log_level and color config from pytest.ini #20

Open marcodicro-dp opened 8 months ago

marcodicro-dp commented 8 months ago

I have this in my pytest.ini to show all logs above DEBUG level with colors.

# Capture all logs above DEBUG level
log_level=DEBUG
# Print colorized output to the terminal
addopts=--color=yes

That works fine when running tests with tox in my terminal. But this is not working when I run tests in Pycharm. Only the basic logs are shown.

I've also tried with addopts=--log-cli-level=DEBUG --color=yes But does not work.

For that to work in Pycharm too, I have to add this as additional arguments in the Run Configuration Template: --log-cli-level=DEBUG --color=yes

Note: the plugin DOES pickup my python_classes configuration: python_classes = *Test *TestCase Showing the green arrow to run those test classes. So the plugin is activated and working.

It would be a nice feature to have, to avoid having duplicated config in pytest.ini and run configuration template.

theY4Kman commented 7 months ago

You might simply want to try running with the "Emulate terminal output" option enabled in the Run Configuration... which I hope exists when using a py.test Run Configuration. Since colour display is just a trick of a terminal emulator in interpreting control characters emitted to the console, it's up to PyCharm's terminal tool window renderer to also interpret those control sequences and display them properly.

marcodicro-dp commented 7 months ago

@theY4Kman Thank you for your answer!

I don't have that option in the Run Configuration:

Screenshot 2024-03-04 at 10 52 42
PyCharm 2023.3.4 (Professional Edition)
Build #PY-233.14475.56, built on February 25, 2024
macOS 14.2.1

I also didn't find it in Pycharm settings.

Apart from that, I really appreciate your suggestion and I understand if this is not a plugin issue.