Skip to content

Test Progress Indicator Hides Stdout From Fixtures After Yield #3029

@trrichard

Description

@trrichard

Change to add progress indicator (that thing that says 100%) to pytest clobbers stdout from fixtures after yield on Ubuntu 14.04 LTS with anaconda python 3.6.3

Change that (probably) introduced the bug:
#2657

Replication instructions:
In the following example the word "postfix" should show up in both outputs. It only shows up in the second output where we have set the console output style to classic.
Create a test file:

import pytest

@pytest.fixture()
def fix():
    print("prefix")
    yield None
    print("postfix")

def test_thing(fix):
    print("in test")

Run the test with -s
pytest test.py -s
Output:

test.py prefix
in test
.

Disable the progress feature by creating a file pytest.ini

[pytest]
console_output_style=classic

Run the test with -s
pytest test.py -s
Output:

test.py prefix
in test
.postfix

Pip List

attrs (17.3.0)
certifi (2017.11.5)
pip (9.0.1)
pluggy (0.6.0)
py (1.5.2)
pytest (3.3.1)
setuptools (36.5.0.post20170921)
six (1.11.0)
wheel (0.30.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: reportingrelated to terminal output and user-facing messages and errorstype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions