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
{{ message }}
Repository navigation
Test Progress Indicator Hides Stdout From Fixtures After Yield #3029
topic: reportingrelated to terminal output and user-facing messages and errorstype: enhancementnew feature or API change, should be merged into features branch
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
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:
What happens is that the progress indicator is triggered by the end of the test call phase; it works by writing enough spaces to reach the end of the line + the percentage indicator. Then the teardown execution happens (after the yield in the fixture), and the output gets printed past that.
When you use the classic style, only the . is written to the output at the end of the test call phase, and then you get the output from the teardown execution.
I see two options how to proceed here:
Automatically revert to "classic" style when using -s: any output here will greatly mess up the progress indicator anyway;
Display the output indicator after the teardown phase; this might be a problem because tests which fail setup won't have a teardown phase.
I'm personally included to 1) because it is the easiest one to implement and will provide the better UX in the end IMO, but would like to hear others options on this.
topic: reportingrelated to terminal output and user-facing messages and errorstype: enhancementnew feature or API change, should be merged into features branch
Activity
pytestbot commentedon Dec 13, 2017
GitMate.io thinks the contributor most likely able to help you is @nicoddemus.
nicoddemus commentedon Dec 14, 2017
Hey @trrichard thanks for writing!
What happens is that the progress indicator is triggered by the end of the test call phase; it works by writing enough spaces to reach the end of the line + the percentage indicator. Then the teardown execution happens (after the
yieldin the fixture), and the output gets printed past that.When you use the classic style, only the
.is written to the output at the end of the test call phase, and then you get the output from the teardown execution.I see two options how to proceed here:
-s: any output here will greatly mess up the progress indicator anyway;setupwon't have a teardown phase.I'm personally included to 1) because it is the easiest one to implement and will provide the better UX in the end IMO, but would like to hear others options on this.
trrichard commentedon Dec 15, 2017
Agreed. I think it's odd to print anything other than test seperation headers (such as ==== test_name.py ====) between tests when using the -s option.
I would do option 1 or don't print any progress message (
.included ) for tests with -s enabled.nicoddemus commentedon Dec 15, 2017
Cool. Closing this then in favor of #3038. 👍