Skip to content

Terminal reporter doesn't print #8973

Open
@gaborbernat

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.).

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