-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
topic: collectionrelated to the collection phaserelated to the collection phasetopic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errors
Description
Hi,
We like to use --color=yes
when running py.test in continuous integration services like Jenkins (with the Ansi Color Plugin). This enables us to see the same nice colors in Jenkins that we see on the terminal.
The only problem is that the "collecting" display progress actually piles up in the terminal because py.test output is being redirected and captured by the server. This can easily be reproduced by redirecting to a file instead:
import pytest
@pytest.mark.parametrize('i', range(10))
def test_foo(i):
if i == 5:
assert 0
py.test --color=yes test_foo.py > out
Contents of out
:
�[1m============================= test session starts =============================�[0m
platform win32 -- Python 2.7.11, pytest-2.8.5, py-1.4.31, pluggy-0.3.1
rootdir: x:\jobs_done10, inifile:
�[1m
collecting 0 items�[0m�[1m
collecting 10 items�[0m�[1m
collected 10 items
�[0m
foo.py .....F....
================================== FAILURES ===================================
�[1m�[31m_________________________________ test_foo[5] _________________________________�[0m
i = 5
�[1m @pytest.mark.parametrize('i', range(10))�[0m
�[1m def test_foo(i):�[0m
�[1m if i == 5:�[0m
�[1m> assert 0�[0m
�[1m�[31mE assert 0�[0m
foo.py:6: AssertionError
�[1m�[31m===================== 1 failed, 9 passed in 0.02 seconds ======================�[0m
The color codes are correct, but the "collecting" messages are a problem because they occupy many lines of output in test suites with hundreds of tests.
Is there any way to prevent those "collecting" messages from appearing? -q
gets rid of them, but I want the header to appear, specially in CI.
Metadata
Metadata
Assignees
Labels
topic: collectionrelated to the collection phaserelated to the collection phasetopic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errors