pytest-dev / pytest-dev/pytest
The colors of the logs are not displayed using --capture=tee-sys
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
- a detailed description of the bug or problem you are having:
When I use --capture=tee-sys instead of -s the logs are not colored anymore. Example:
The source of the issue is that I want to capture to logs to put them in an HTML report, but I also want to see live what is going on in the test as it takes a long time to execute and I need to check the progress. Not having the colors makes it harder to read.
- output of
pip listfrom the virtual environment you are using
colorama==0.4.6
exceptiongroup==1.1.2
iniconfig==2.0.0
loguru==0.7.0
packaging==23.1
pluggy==1.2.0
pytest==7.4.0
tomli==2.0.1
win32-setctime==1.1.0
- pytest and operating system versions
Windows 10:
Python 3.10.10
- minimal example if possible:
"""
My test module
"""
from loguru import logger
def test_color():
"""
My test
"""
logger.info("My colored log")
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the minimal Python test with Loguru on Windows using --capture=tee-sys and compare it with -s. Trace pytest's tee-sys capture path and determine why colored log output is removed while being displayed. Done means the logs remain colored in the live terminal and are still captured for the HTML report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100