mkorpela / pabot

Parallel executor for Robot Framework test cases.
https://pabot.org
Apache License 2.0
476 stars 152 forks source link

Force coloring of the stdout when integrated in CI tools (eg: Gitlab) #470

Open kitschyboy opened 2 years ago

kitschyboy commented 2 years ago

When Pabot is launched by a Gitlab runner, the output is redirected and printed in the Gitlab job console. The current implementation of coloring in Pabot checks if Pabot runs in a terminal, and prevents the output from being colored if not (https://github.com/mkorpela/pabot/pull/31)

However, Gitlab supports coloring of the jobs log, and it would be interesting to be able to force the colored output: for instance, you can do it in Ansible using the environment variable ANSIBLE_FORCE_COLOR.

These is a pull request implementing this mechanism : if the environment variable PABOT_FORCE_COLOR is set to 'true' or '1', we force the output coloring, regardless of the os or redirection. I tested in our Gitlab CI and it works correctly.

Thanks in advance for your review.