Open
Description
# 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.
).