You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have being trying to make stestr to use coloring on output under tox but apparently it does not want to respect the --color flag.
When run outside tox, and mentioning --color, it works as expected. Even so, coloring is not enabled by default when user have interactive console, and it should be, just like other tools (including tox).
Steps to reproduce the problem
Use stester run --color inside tox.ini.
System information
stestr version (stestr --version):
2.1.0
Python release (python --version):
py27
pip packages (pip freeze):
Additional information
The text was updated successfully, but these errors were encountered:
I'm not sure if there is anything we can do here in the stestr for this case. I was able to reproduce this in tox, and I added some print statements to stestr to find why the color was being printed. The underlying issue is when we call the curses module from stdlib to setup the colors at https://github.com/mtreinish/stestr/blob/master/stestr/colorizer.py#L71 it raises an error:
setupterm: could not find terminfo database
Which probably means that tox is not passing through $TERM from your terminal to the commands it's running. This is preventing the color from being set by stestr when it's writing to stdout and it falls back to not using color.
As for the color being enabled by default. I feel like this is one of those places where different people will have different preferences. Which is why it's an option in the user config file, so if you prefer to have color on by default (it will still fallback if it can't use it) you can just set that in your user config file: https://stestr.readthedocs.io/en/latest/MANUAL.html#user-config-files
Yeah, I just confirmed that this can work with tox. You just need to add passenv=TERM in the testenv in your tox.ini (or set TOX_TESTENV_PASSENV=TERM in your env when you run tox), Otherwise tox will not pass through the $TERM env variable and the curses module won't be able to figure out what terminal is in use.
I'm going to mark this is as closed because I don't see anything we can do to fix this from stestr itself. Feel free to re-open if I'm missing something.
Issue description
I have being trying to make stestr to use coloring on output under tox but apparently it does not want to respect the --color flag.
When run outside tox, and mentioning --color, it works as expected. Even so, coloring is not enabled by default when user have interactive console, and it should be, just like other tools (including tox).
Steps to reproduce the problem
Use
stester run --color
inside tox.ini.System information
stestr version (
stestr --version
):2.1.0
Python release (
python --version
):py27
pip packages (
pip freeze
):Additional information
The text was updated successfully, but these errors were encountered: