Skip to content

Terminal reporter doesn't print #8973

Description

@gaborbernat
# test_a.py
def test_foo(request):
    reporter = request.config.pluginmanager.getplugin("terminalreporter")
    reporter.ensure_newline()
    reporter.write("magic", flush=True)

If you run the above file through pytest nothing is written on the output.

$ pytest . 

platform linux -- Python 3.9.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /tmp/workdir
plugins: print-0.3.0
collected 1 item

test_a.py .   [100%]

Though I'd expect something like:

$ pytest . 

platform linux -- Python 3.9.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /tmp/workdir
plugins: print-0.3.0
collected 1 item

test_a.py
   magic .
   [100%]

Note if you remove the flush we do get the message printed, but without respecting the ensure newline (instead you get test_a.py magic.).

Activity

  1. added
    topic: reportingrelated to terminal output and user-facing messages and errors
    type: bugproblem that needs to be addressed
    type: regressionindicates a problem that was introduced in a release which was working previously
    on Aug 3, 2021
  2. RonnyPfannschmidt commented on Sep 26, 2021

    @RonnyPfannschmidt
    Member

    @gaborbernat extra fun, without flush it works on pytest 6.x+

  3. gaborbernat commented on Sep 26, 2021

    @gaborbernat
    ContributorAuthor

    Eh what 😂

  4. RonnyPfannschmidt commented on Sep 26, 2021

    @RonnyPfannschmidt
    Member

    @gaborbernat i identified the core issue - terminalwriter for some reason is not using a dup-ed stdout, so it is subject to capture intervention,l i will work out a bugfix later on

  5. gaborbernat commented on Sep 27, 2021

    @gaborbernat
    ContributorAuthor

    Great 👍

  6. gaborbernat commented on Dec 29, 2021

    @gaborbernat
    ContributorAuthor

    @RonnyPfannschmidt has this been addressed?

  7. RonnyPfannschmidt commented on Dec 29, 2021

    @RonnyPfannschmidt
    Member

    No

  8. emileakbarzadeh commented on Nov 6, 2024

    @emileakbarzadeh

    Any updates?

  9. added a commit that references this issue on Oct 26, 2025
    606a268
  10. added 3 commits that reference this issue on Jul 24, 2026
    8ee87af
    5560219
    314979a
  11. added 2 commits that reference this issue on Sep 12, 2026
    ef27577
    005bd65
  12. added a commit that references this issue on Sep 23, 2026
    07449cb
  13. gaborbernat commented on Sep 23, 2026

    @gaborbernat
    ContributorAuthor

    There does not seem to be enough interest in this, so I am closing it. Thanks for taking a look.

  14. RonnyPfannschmidt commented on Sep 24, 2026

    @RonnyPfannschmidt
    Member

    there is actually a work in progress that resolves this

  15. added a commit that references this issue on Oct 4, 2026
    b5c0efb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: reportingrelated to terminal output and user-facing messages and errorstype: bugproblem that needs to be addressedtype: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions